dmontano Posted Monday at 09:09 AM Posted Monday at 09:09 AM Hello, My first time trying to pass more than one parameter to a script. My research (potentially flawed) has led me to believe that one of the most robust ways of passing multiple parameters was to use JSON. I have copied JSON code from the internet and modified the code to try and work with my data to accomplish my task. I've tried my best, but I need help. This is the JSON I have in the "Optional Script Parameter" dialog window: JSONSetElement ( "" ; ["name"; item_feature_location::item_feature_location_name; JSONString ]; ["status_type"; item_feature_location__status_portal__status_type::status_type_name; JSONString ] ) When I copy and paste the above code into the data viewer, it does give me the first parameter value, but it does not give me the second parameter value. What Does work: First parameter field = item_feature_location::item_feature_location_name What Does not work: Second parameter field = item_feature_location__status_portal__status_type::status_type_name What I Notice The only thing I notice that is different between the two parameters is that the second one is from a related table. Attaching screenshots of: Optional Script Parameter Script Variable of Parameters (Script) Data Viewer Result Any help is appreciated.
comment Posted Monday at 09:53 AM Posted Monday at 09:53 AM AFAICT the problem is not with constructing the JSON but with accessing the related value. You can verify this by evaluating only: item_feature_location__status_portal__status_type::status_type_name in the Data Viewer, using the same context. I believe it will return an empty string. Keep in mind that when referring to a related field, the calculation will retrieve data from the first related record, in the sort order of the relationship.
dmontano Posted Monday at 05:35 PM Author Posted Monday at 05:35 PM 7 hours ago, comment said: AFAICT the problem is not with constructing the JSON but with accessing the related value. You can verify this by evaluating only: item_feature_location__status_portal__status_type::status_type_name in the Data Viewer, using the same context. I believe it will return an empty string. When I evaluate that related field, it is successful: see screenshot. Any other ideas?
comment Posted Monday at 05:58 PM Posted Monday at 05:58 PM 15 minutes ago, dmontano said: Any other ideas? Not really. Your formula for constructing the JSON is correct and if the referenced field contains the text "Active" you should be getting the result you expect. Is it possible that the two tests were performed from different records?
dmontano Posted Monday at 06:06 PM Author Posted Monday at 06:06 PM 6 minutes ago, comment said: Is it possible that the two tests were performed from different records? Bingo. That must be it — because now it works. Thank you very much!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now