discovery pattern variable returning partial string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2017 08:08 AM
I'm parsing command output from an sql query into a variable (not a table or list, 1 position, no delimiters - so it captures all of the returned text as a single variable). When I try to write that to an attribute, it returns only the first entry, not the entire string, as if it were parting a list.
How do I get it to record the entire string into the attribute instead of just the first entry?
Thanks in advance for your help.
- Labels:
-
Discovery
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2017 08:36 AM
It is a list - you'll need to capture it as a table then loop through each line to obtain the information you want.
Alternatively, amend your SQL statement to return one row with concatenated data then parse that one line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2017 08:10 AM
Thanks for your help, but I'm not quite getting there.
I'm reading the output from the query into a table:
Then using the following javascript to parse through it to create one long string variable out of it:
EVAL(javascript: var rtrn = ''; var config_params = ''; rtrn = for (var i = 0; i < config_table.length; i++) { config_params += config_table[i] + ','; })
I then write that to the table attribute.
While the javascript works, I'm getting an error in the mid-server log
12/15/17 11:06:07 (469) Worker-Interactive:PatternDebuggerProbe WARNING *** WARNING *** org.mozilla.javascript.EvaluatorException: syntax error (ad_hoc:EvalClosure-Record u_configuration_parameters; line 1)
EvaluatorException( var rtrn = ''; var config_params = ''; rtrn = for (var i = 0; i < config_table.length; i++) { config_params += config_table[i] + ','; })
12/15/17 11:06:07 (469) Worker-Interactive:PatternDebuggerProbe WARNING *** WARNING *** Error while setting attribute. : JAVASCRIPT_CODE_FAILURE: EvaluatorException( var rtrn = ''; var config_params = ''; rtrn = for (var i = 0; i < config_table.length; i++) { config_params += config_table[i] + ','; })
Any help is appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 02:27 AM
While the javascript works
How do you know this? What tests did you try?
EVAL(javascript: var rtrn = ''; var config_params = ''; rtrn = for (var i = 0; i < config_table.length; i++) { config_params += config_table[i] + ','; })
Is that part right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2017 10:52 PM
Hi Nancy,
Looks like the attribute you are trying to populate is of STRING TYPE on the table.
If you parsing logic is correct and you are able to get your string,
Try increasing the limit of the field (u_configuration_parameters). By default it is 40.
eg: I have increased it to 200.
Thanks,
Prabhash