Setting Value - Data Location as Variable

Posted by: skup

Setting Value - Data Location as Variable - 06/16/20 04:29 PM

Hi,

I'm trying to add a data location as the Value under a Local Variable, but I do not know how many characters will exist (in my specific case, INTEGERS, although I know it is all treated as STRING).

For example, if I were to enter: @(1,5,5,16,34,KeepCase,Trim), this will guarantee a specific number of characters. What I need is to specify the same line, same starting position, but to grab all of the characters (integers) that exist before the next non-alphanumeric character. (In my case, "<").

How can I do this?

I should amend this question by asking how to get data between two delimiters. My data is essentially "Line Printer" but HTML output. I need to grab data from various lines that exist between tags on those lines.
Posted by: Philippe F.

Re: Setting Value - Data Location as Variable - 06/22/20 09:15 AM

You'll have to use a script. Something similar to this should work:
Code:
var myLine = Watch.ExpandString("@(1,5,5,16,34,KeepCase,Trim)");
var myData = myLine.match(/[^\<]*/);
if(myData.length) {
  Watch.SetJobInfo(9,myData[0]);
}

The regular expression on line 2 grabs everything in the data selection up to the first "<" encountered. Since the results of the match() method is an array, the code then grabs the first element of the array - which represents everything to the left of "<" - and stores it in JobInfo 9.
Posted by: Sami786

Re: Setting Value - Data Location as Variable - 08/31/20 12:29 PM

thank you