I wonder if anyone could me figure out where I've gone wrong. It's a small issue that I assume has something to do a calculation in one of the scripts.
I have the following:
- an Assets Table with many items
- a Request Table with a Request Items table (portal)
- a Globals table with one field (g_SelectForOrder)
I have a "Request" layout with a Button to "Select" (this uses the script iPad: Buttons: iPad | Select sample items request) , this then takes me to another window that will list all available items from "Assets" next to each Asset apart from details and image is a Checkbox image to "tick" (using on image the script iPad: Buttons: iPad | Checkbox set Field) if requried to be included in the Request so that numerous items can be selected at the same time. When the script is continued it creates new portal records into the request with the information stored in the global i.e. assets selected. This Asset record ID information was stored in the Global Field correctly, I can see them fine as a list.
Generally the scripts are working and doing what they are supposed to do except that the first record created in the portal is blank which I assume has something to do with a "pilcro" in one of the formulas somewhere but not sure how to get it not to do it as I end up with an extra useless record.
Appreciate any help I can get. Thanks
iPad: Buttons: iPad | Select sample items request
Set Variable [ $Request; Value:Requests::__kp_RequestID ]
Set Field [ Globals::g_SelectForOrder; "" ]
Go to Layout [ “Samples Selector | iPad Copy” (Assets) ]
Show All Records
Perform Find [ Specified Find Requests: Omit Records; Criteria: Assets::Ignore: “Y” ] [ Restore ]
Sort Records [ Keep records in sorted order; Specified Sort Order: Assets::Type; ascending Assets::Description; ascending Assets::Serial Number; ascending ] [ Restore; No dialog ]
Go to Record/Request/Page
[ First ]
#Pause script to allow user to select items they want to order via checkboxing into a global field
Pause/Resume Script [ Indefinitely ]
Go to Layout [ “Request_items_forLoop” (Requests_items) ]
# Uses a loop to create portal records of selected items
Set Variable [ $FindItem ]
New Record/Request Set Field [ Requests_items::_kf_RequestID; $Request ]
#Need to FIX !!! it's entering first item as a blank then others OK. Maybe something to do with Pilcro?
Set Field [ Requests_items::_kf_AssetID; GetValue (Globals::g_SelectForOrder ; $FindItem) ]
Set Variable [ $FindItem; Value:$FindItem + 1 ]
Exit Loop If [ $FindItem > ValueCount (Globals::g_SelectForOrder) ]
Go to Layout [ “Requests | iPad” (Requests) ]
iPad: Buttons: iPad | Checkbox set Field
Set Field [ Globals::g_SelectForOrder; Case ( ValueCount ( FilterValues ( Globals::g_SelectForOrder ; Assets::Asset ID )) > 0 ; Substitute (Globals::g_SelectForOrder ; Assets::Asset ID & ¶; "" ) ; Globals::g_SelectForOrder & Assets::Asset ID & ¶ )]