602.0 Getting StartedThe above script makes Link*One filter all input data that doesn’t startwith the characters K06.2.10.13.8 Input Data ReplacementsThe replacement function in earlier WLinq versions was quite easy touse. But it lacked power and flexibility. Below is an example of a simplesubstring replacement. It replaces all occurrences of the character Kwith the character X.Multiple replacements can be done by storing the result in a string vari-able and repeat the process. Here K is replaced with X and A is replacedwith TEST.2.10.13.9 CriteriaIn the previous WLinq generation, a data format was activated for a datastring when the criteria of the data format matched. Two types of crite-ria were supported, length and pattern.In Link*One the same function as a length criteria is implemented usingan if-statement.An alternative approach could be:A pattern criteria like the one above could be implemented using thestring.find() pattern matching method:The format used for patterns in string.find() and the format in WLinq3.x is different. Please refer to the Lua documentation for the Lua pat-tern format.A big advantage with scripting in Link*One is that more complex deci-sions can be made, for example mixing length and pattern matching,something that was not possible in WLinq 3.x. Multiple criteria used inWLinq 3.x can be implemented by chaining if-elseif-statements:2.10.13.10 Data Format OutputIn a WLinq 3.x data format, expressions was entered into the data formatoutput edit box and combined with plus (+). In Link*One, all the stringoperations are using the facilities of the embedded script language. Tomake Link*One simulate a possibly modified string as keyboard output,you need to pass the string to the method app.send().Use the table below as a guide for converting expressions in WLinq 3.xto Link*One. Most string operations in WLinq 3.x operated on the datainput string implicitly. In Link*One, the data string is an argument sentto the script methods onData(), onKeyboardCapture(), and on-ExternalData().Constant StringWLinq 3.x Link*One“ABC” “ABC”Extract a substring from the start of the stringWLinq 3.x Link*OneLeft( 3 ) string.sub( data, 1, 3 )string.sub( data, -3 )WLinq 3.x Link*OneRight( 3 ) string.sub( data, -3 )Extract characters from position three up to position four.Please note the difference in parameters!WLinq 3.x Link*OneMid( 3, 2 ) string.sub( data, 3, 4 )From the first A in the string, extract five characters includ-ing the AWLinq 3.x Link*OneMid( “A”, 5 ) string.gsub( data, “.*(A....).*”, “%1” )Extracts characters from position six to the end of the stringWLinq 3.x Link*OneMid( 6 ) string.sub( data, 6 )Scans for the first string and extracts all characters up tothe second string.23 and CD is not included in the result.WLinq 3.x Link*OneSubStr( “23”, “CD” ) string.gsub( data, “.*23(.*)CD.*”, “%1” )The entire data stringWLinq 3.x Link*OneInput() dataInserts the current date in the specified formatWLinq 3.x Link*OneDate( “%Y-%m-%d” ) os.date( “%Y-%m-%d” )