Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] tXMLMap - get only first expression filtered row

Hi all,
Im working with a tXMLMap in extracting some fields from an XML file into single variables. I have an expression filter in the output row on a certain tag in the XML, which works fine since I am getting the expected rows.
But, I only need to get the first filtered row and send it to a tJavaRow component, how is this possible? (I can tell it loops since it prints the same outputs over the number of rows returned)
Thanks
Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

...tXMLMap---main--tMap--out1--tJavaRow
on tMap, add a new variable called var1 in Var table, and set its expression values as:
Numeric.sequence("s1",1,1)
In the output table of tMap, add a filter expression to filter only the first row:
Var.var1==1

I hope this helps!

View solution in original post

7 Replies
Anonymous
Not applicable
Author

Hi 
You may add a sequence id to each row on a tMap and filter the first row.
Anonymous
Not applicable
Author

Hi shong,
Thanks for the suggestion, but can you give me an example of this solution? I cant seem to grasp the actual implementation.
Anonymous
Not applicable
Author

...tXMLMap---main--tMap--out1--tJavaRow
on tMap, add a new variable called var1 in Var table, and set its expression values as:
Numeric.sequence("s1",1,1)
In the output table of tMap, add a filter expression to filter only the first row:
Var.var1==1

I hope this helps!
Anonymous
Not applicable
Author

Hi shong,
The added variable works, thanks. But I have another problem:
I am adding a filter expression in the output row (String variable) of the tXMLMap, which returns 2 or more instances from the input row XML (Document variable). How can I set it to only return 1 row from the filtered expression?
Example: I am sending an XML that has a loop of 10 operators, and from my filter expression, I got 7 available operators. How can I make the mapping/looping/filtering only pass to the next component only 1 available operator?
Anonymous
Not applicable
Author

Hi 
What's  your filter expression? Can you give me an example to explain your problem?
Anonymous
Not applicable
Author

Im filtering it with a value in an element in the XML shong.
Example: I am sending an XML that has a loop of  10  operators, and from my filter expression, I got  7  available operators. How can I make the mapping/looping/filtering only pass to the next component only  1 available operator?
Anonymous
Not applicable
Author

As I said, add a sequence ID to the 7 operators on another tMap and filter the first line.