Storetext from a table help to choice correct lines to store

Hi @Plankton @Timo @thecoder2012 @ulrich

I need to storetext all lines from a table where CODICE CATASTALE have a value

I add an image to show, I need to save all line in variable with storetext with this characteristic CODICE CATASTALE have a value, in the image I add 1 - 2 - 3 - 4 to explain line to store.

This is a relative storetext when CODICE CATASTALE have a number store the line.

Here the page

nonsolocap.it/cap?k=56040

Image

Thanks for suggestion

I would extract each value, and then check if the length of the string in the 7th column is > 1.

Here is a working test macro

To add:

  • loop ${x} from 2…end to extract all rows
  • store all values in CSV, not just ${c1}

v1:

{
      "Name": "conditional_extract",
      "CreationDate": "2020-1-22",
      "Commands": [
        {
          "Command": "open",
          "Target": "https://www.nonsolocap.it/cap?k=56040",
          "Value": ""
        },
        {
          "Command": "store",
          "Target": "3",
          "Value": "x"
        },
        {
          "Command": "storeText",
          "Target": "xpath=//*[@id=\"po\"]/table/tbody/tr[${x}]/td[1]",
          "Value": "c1"
        },
        {
          "Command": "storeText",
          "Target": "xpath=//*[@id=\"po\"]/table/tbody/tr[${x}]/td[1]",
          "Value": "c2"
        },
        {
          "Command": "storeText",
          "Target": "xpath=//*[@id=\"po\"]/table/tbody/tr[${x}]/td[2]",
          "Value": "c3"
        },
        {
          "Command": "storeText",
          "Target": "xpath=//*[@id=\"po\"]/table/tbody/tr[${x}]/td[3]",
          "Value": "c4"
        },
        {
          "Command": "storeText",
          "Target": "xpath=//*[@id=\"po\"]/table/tbody/tr[${x}]/td[4]",
          "Value": "c5"
        },
        {
          "Command": "storeText",
          "Target": "xpath=//*[@id=\"po\"]/table/tbody/tr[${x}]/td[5]",
          "Value": "c6"
        },
        {
          "Command": "storeText",
          "Target": "xpath=//*[@id=\"po\"]/table/tbody/tr[${x}]/td[6]",
          "Value": "c7"
        },
        {
          "Command": "echo",
          "Target": "This row is ${c1} | ${c2}| ${c3}| ${c4}| ${c5}| ${c6}| ${c7}|",
          "Value": "blue"
        },
        {
          "Command": "if_v2",
          "Target": "${c7}.length > 1",
          "Value": ""
        },
        {
          "Command": "echo",
          "Target": "Now store the line!",
          "Value": "green"
        },
        {
          "Command": "store",
          "Target": "${c1}",
          "Value": "!csvLine"
        },
        {
          "Command": "end",
          "Target": "",
          "Value": ""
        }
      ]
    }

Thanks your code working like a charm