Quick way to get multiple text fields into a data table?

Kevin_579059
Kevin_579059 Posts: 67
edited April 2020 in Questions

Hello,
There are a couple of Actions that output text fields for each individual result "found" or "hit". For example, Browser: Save Text from Element on Web page creates individual text fields for every match found, in the following format:

nameyouselect--0
nameyouselect--1
nameyouselect--2
nameyouselect--3
nameyouselect--4
and so on

Is there a quick way to take all these individual text fields and put them into a table? I am not that good with creating Catalytic loops yet (if that's the answer), but I wonder if there's an Action that can accomplish this.

With VBA, it would be something like

integer = 0
numhits = number of nameyouselect--## fields
While integer <= numhits
[command to take each field one at a time, and make a table]
integer = integer + 1
While End

My solution now (so I can fast forward and get to the fun part of the bot) is to just use Tables: Convert Text to Table and type out each hit, which is very cumbersome.

Might the solution be something along the lines of the following:

[Field Formulas (to concatenate a string and integer)]
newname = “nameyouselect--" + integer
[Tables:Convert text to table] [or Add Row to Table?]
{{newname}}
[Increase the integer]
Integer + 1
[loop back]

thanks!
Kevin

Answers

  • Jozef_783863
    Jozef_783863 Posts: 331 admin

    @Kevin_579059,

    Based on the help article, Browser: Save Text from Element on Web Page to Field creates a table if the CSS Selector matches multiple elements. So, this action does not create a table if the CSS Selector matches only one element (like you described with nameyouselect--0, nameyouselect--1, etc).

    Is it possible in your case to use a CSS Selector that matches multiple elements, to output a data table, then filter down the data table?

  • Thanks, Jozef! I think the instructions on this page have a conflict. At the bottom it says:
    If there are multiple matches, each match is output to a unique field. For each match, --0, --1, --2, etc. is added to the output field.
    Or am I mixing some things up?
    I checked the output Fields of my bot and all I see is nameyouselect--0, --1, --2, etc., but no table.
    Kevin

  • Jozef_783863
    Jozef_783863 Posts: 331 admin

    Hey Kevin,

    I do see that article conflict now between the start/end information on outputs.

    I wonder if there is still an output distinction between a CSS Selector matching multiple HTML elements (table output) & multiple matches of text matching one HTML element (fields output).

    I will submit this question to the team and follow-up with you over email. In the meantime, if you try a CSS Selector parent of an element on a web page, you can see if a table outputs or not.

    Thank you!