check if the string exists using imacros

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
bilgamyompi
Posts: 30
Joined: Mon Feb 12, 2018 7:03 pm

check if the string exists using imacros

Post by bilgamyompi » Thu Feb 15, 2018 8:31 pm

i need to check if the string exist.

Code: Select all

VERSION BUILD=12.0.501.6698
SET !DATASOURCE e.txt
SET !VAR NULL
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=A ATTR=TXT:{{!COL1}} CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=A ATTR=CLASS:inp CONTENT=!VAR
So if

Code: Select all

TAG POS=1 TYPE=A ATTR=TXT:{{!COL1}}
doesn't exist !VAR will be null but if exist will be the value of {{!COL1}}.
i researched a little and found some ways using var eval
http://wiki.imacros.net/Demo-Eval

But i'm not sure how to get check if the string exist to asign the correct value and if doesnt exist put in empty?
bilgamyompi
Posts: 30
Joined: Mon Feb 12, 2018 7:03 pm

Re: check if the string exists using imacros

Post by bilgamyompi » Fri Feb 16, 2018 1:23 pm

something like this?

Code: Select all

SET !VAR NULL
TAG POS=1 TYPE=A ATTR=TXT:{{!COL1}} EXTRACT=TXT
SET !VAR1 EVAL("var m = '{{!EXTRACT}}'; if (!m) '{{!VAR}}' = NULL;else '{{!VAR}}' = m;")
Post Reply