cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Match Type

cstull
Level 2

I'm leveraging a dynamic match type for a series of web input fields where I can not predict the total # of fields.

For instance, there at 3 input fields with a WebID of Field1, Field2, & Field3 -- sometimes there will be 1 field and upto 200.

I want to loop through each field using a dynamic match type on Web ID and validate if the field actually exists.

How can I determine if the App Modeller Element exists or not?  

1 BEST ANSWER

Helpful Answers

MichealCharron
Level 8

@cstull 

If the fields are numbered consecutively and they appear in the page's HTML one after another, there is a couple of quick ways determine what is the current last field.

The way I would not recommend is create an element with the attributes of Match Reverse, with a Match Index of 1 and put a wildcard on the Web Id attribute (Field*).

The way I would recommend is create an element that uses an XPath expression the would give you the last element that matches those IDs:

(//input[starts-with(@id,'Field')])[last()]

MichealCharron_0-1717182989068.png

With either method above, you can then use the Get ID action in a read stage to retrieve the ID of the that last element to parse out the number of fields.

MichealCharron_1-1717183353398.png

MichealCharron_2-1717183379037.png

 

 

 

Micheal Charron
RBC
Toronto, Ontario
Canada

View answer in original post

2 REPLIES 2

MichealCharron
Level 8

@cstull 

If the fields are numbered consecutively and they appear in the page's HTML one after another, there is a couple of quick ways determine what is the current last field.

The way I would not recommend is create an element with the attributes of Match Reverse, with a Match Index of 1 and put a wildcard on the Web Id attribute (Field*).

The way I would recommend is create an element that uses an XPath expression the would give you the last element that matches those IDs:

(//input[starts-with(@id,'Field')])[last()]

MichealCharron_0-1717182989068.png

With either method above, you can then use the Get ID action in a read stage to retrieve the ID of the that last element to parse out the number of fields.

MichealCharron_1-1717183353398.png

MichealCharron_2-1717183379037.png

 

 

 

Micheal Charron
RBC
Toronto, Ontario
Canada

Thank you -- it did not quite work but I love the idea and I will keep trying with this approach.