2 Replies Latest reply on Aug 12, 2014 7:30 AM by ChadBarnard

    Using an If script/function to auto-populate a field



      Using an If script/function to auto-populate a field


           Hey guys,

           I'm confused about what I'm doing wrong here and need some guidance.

           Once someone picks a state for an order, I'm wanting to auto-populate the permit and underground fields.  I know how to do each separately with value lists, but since there's two tables' information being pulled, I figured that I could run an If script/function.  But I must be missing something.

           At first, I tried to make the underground phone number field in the Orders table a calculation:

                           If ( OrderState = Underground::UndergroundState ; Lookup ( Underground::UndergroundPhoneNumber ) ; "" )

           That didn't work, so I tried a setting an OnObjectSave script trigger on the Orders State field to the following script:

                           If [Orders::OrderState= Underground::UndergroundState]
                                           Go to Field [Orders::OrdersUnderground]
                                            Insert Text [Select; Underground::UndergroundPhoneNumber]
                          End If

           Instead of the Insert Text, I've tried some Get functions, but still no luck.  I have tried relating the tables by pk and fk as well as by OrderState and UndergroundState.  

           Thanks for any help/clarification that you can offer.