on ‎2007 May 29 5:38 PM
I want to programitically add values to a local property in a loop, and then later check to see if a specific value exists in this property.
I'm assuming I use an property of Type XML. When I want to add a value to this property, I only have the option to "Assign Value" is this correct? if not, how do I append.
2nd, Once I have this property populated, how can I check to see if it contains a particule value? Is it possible using an aggregate function(possible the distinct value extractor), so I don't have to loop through the contents?
Thanks,
Jeff
Request clarification before answering.
Jeff,
Yes a Local property of type XML would be the right way to do this, but a simple IllumDoc would also be quite easy to create and manage since the building blocks are quite easy to use. With the XML route you would need to use the Append XML link type to take your source xml stub and append it to an outer xml stub in the local property, thereby 'appending' a node or nodeset to your local property. If using the IllumDoc way it would be as simple as adding a new Row action and creating the columns and links accordingly.
You can use simple xpath to check for existence or the xpath count function. If you need to find the position number that could be referenced too. These would be ways to avoid looping to find records. A vast majority of the xml actions (especally in the XML Functions category) expect the source document to be in Rowsets/Rowsets/Row format so that may also lead you to the IllumDoc option.
Regards,
Jeremy Good
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the reply Jeremy. I have created a new illum doc with 2 fields(ID1, ID2) and am able to populate it; However I am having problems with the "check for existence" xpath, because it doesn't appear to be checking all values in the document.
My xpath looks similar to this...I changed the names of the fields an local properties to ID1, ID2 ....I just want to see if a record exists in the illumdoc where the values of ID1 and ID2 match my local properties....Is this correct?
(TempIllumDOc.Output{/Rowsets/Rowset/Row/ID1} == Local._ID1 and TempIllumDOc.Output{/Rowsets/Rowset/Row/ID2} == Local._ID2)
thanks
Jeff,
If the local property values are strings and are dynamic variables then you will need to have your statement look like this:
( ('#TempIllumDOc.Output{/Rowsets/Rowset/Row/ID1}#' = '#Local._ID1#') and ('#TempIllumDOc.Output{/Rowsets/Rowset/Row/ID2}#' = '#Local._ID2#') )
Hope that helps.
-Sam
Message was edited by:
Salvatore Castro
Sorry, when I changed the xpath to make it easier to read, I removed the #'s. My Fault.
The if statement is working with the local properties, but it is only evaluating true for the 1st record in the illum doc. In other words, it is not checking all the values in the document. I even tried making the if statment have 2 inputs so simplify the statement. Here is the statement without and changes
(MetricIDsAddedToReturnDOC.Output{/Rowsets/Rowset/Row/MetricID} == "#Local._currentMetricID#")
(MetricIDsAddedToReturnDOC.Output{/Rowsets/Rowset/Row/SiteID} == "#Local._currrentSiteID#")
Should it check all the values by default(ie loop) or doI need to specify that?
Jeff,
Instead of adding the Aggregate action block just use an expression like the following in a conditional action:
(MetricIDsAddedToReturnDOC.Output{count(/Rowsets/Rowset/Row[MetricID = '#Local._currentMetricID#'])} > 0)
This will check to see if the 'count' of Rows in your document that match the local metric id property is greater than 0.
Regards,
Jeremy
Jeff,
There may be an easier way depeding on your scenario and how many values you will be handling. You can use a Local String property and append a comma separated list of values, no spaces, and use the StringListToXML under XML functions then use XPath to check if a value exists of not that meets your criteria in a conditional block. Hope that this helps.
-Sam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.