Topic Options
#57513 - 06/16/20 04:29 PM Setting Value - Data Location as Variable
skup Offline
OL Newbie

Registered: 11/30/19
Posts: 1

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.

Edited by skup (06/16/20 04:35 PM)

#57524 - 06/22/20 09:15 AM Re: Setting Value - Data Location as Variable [Re: skup]
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1970
Loc: Objectif Lune, Montreal, Qc
You'll have to use a script. Something similar to this should work:
var myLine = Watch.ExpandString("@(1,5,5,16,34,KeepCase,Trim)");
var myData = myLine.match(/[^\<]*/);
if(myData.length) {

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.
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

#57653 - 08/31/20 12:29 PM Re: Setting Value - Data Location as Variable [Re: skup]
Sami786 Offline
OL Expert

Registered: 01/29/14
Posts: 394
Loc: Home
thank you