Guest s_k_123456 Posted April 28, 2008 Share Posted April 28, 2008 Hi, I wanted to add new line in portal, like if i select one from drop down it add one line in portal, if select 2 then two line in portal Please help, Shiva Link to comment Share on other sites More sharing options...
Maarten Witberg Posted April 28, 2008 Share Posted April 28, 2008 Hi Shiva A script to create multiple related items could look something like this: # you're in the parent table if [ not get (scriptparameter) // no parameter set or no value selected ] show custom dialog [ "!" ; "no value selected" ] halt script end if set variable [ $Parent ; ParentTable::ParentID ] set variable [ $total ; get ( scriptparameter ) ] set variable [ $count ; 1 ] go to layout [ Child (ChildTable) ] loop new record / request set field [ ChildTable::ParentID ; $Parent ] commit records / requests exit loop if [ $count ≥ [color=Red][b]$total[/b][/color]] set variable [ $count ; $count + 1 ] end loop go to layout [ original layout ] commit records / requests the script parameter is pulled from the value selected by the user from the drop down. Link to comment Share on other sites More sharing options...
Guest s_k_123456 Posted April 28, 2008 Share Posted April 28, 2008 Hi, Thank you! Link to comment Share on other sites More sharing options...
Maarten Witberg Posted April 28, 2008 Share Posted April 28, 2008 Oops, a typo: see edit in red in the script! Oh Really! Link to comment Share on other sites More sharing options...
Guest s_k_123456 Posted April 28, 2008 Share Posted April 28, 2008 ok,smiley-smile Link to comment Share on other sites More sharing options...
Guest s_k_123456 Posted April 28, 2008 Share Posted April 28, 2008 One more question, could u please tell me how can we set that , a script perform on chage of drop down menu item. Shiva Link to comment Share on other sites More sharing options...
Maarten Witberg Posted April 28, 2008 Share Posted April 28, 2008 You need a plugin to trigger scripts based on field values. Try ZippScript or DoScript (I can say ZippScript works fine, I have no experience with DoScript. There may be other plugins that do this.) But I would not use a script trigger in cases like this. Suppose the user accidentally selects "10" if he meant "2" (it happens...)... you need a undo feature. Better use a simple "go" button.... my 2 cents. Link to comment Share on other sites More sharing options...
orangej Posted July 10, 2009 Share Posted July 10, 2009 am misunderstanding something our Fields are like this Field: Available Days (Number Field) on Table 1 Field: Dates (Date Field) Table 2 need the # of new records created based from the number in the Available days field. i need it to create that number (in the available days field) to create that number of related records in our portal. I hope this makes sense I think the script is gonna work but I am missing something Example: Available Days = 7 7 new related records created If you can help THANK YOU! VERY MUCH! # you're in the parent table if [ not get (scriptparameter) // no parameter set or no value selected ] show custom dialog [ "!" ; "no value selected" ] halt script end if set variable [ $Parent ; ParentTable::ParentID ] set variable [ $total ; get ( scriptparameter ) ] set variable [ $count ; 1 ] go to layout [ Child (ChildTable) ] loop new record / request set field [ ChildTable::ParentID ; $Parent ] commit records / requests exit loop if [ $count ≥ $total] set variable [ $count ; $count + 1 ] end loop go to layout [ original layout ] commit records / requests Link to comment Share on other sites More sharing options...
Recommended Posts