Author Topic: Using Search Option with Set Command  (Read 3524 times)

Sai Siddhartha

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 47
    • View Profile
Using Search Option with Set Command
« on: August 17, 2017, 09:51:23 AM »
Purpose:

Using "search" option in "set" command, you can search in the specified text and return the next immediate string in the text to a variable or field.
If the word you are searching for is not in the original string, then it returns blank string.
This is very useful in scenarios like extracting an order number from a successful saving message.

Usage:

The search option specifies that a given string will be searched in the relevant text.

Syntax:

set("variable/field","original string",{"search":"string"});

Where "original string" refers to the text that will be searched.
"string"refers to the word you want to search for.
"variable/filed" to which the result of the search will be assigned.

Liquid UI Script:
///////////////////////////////SAPLSMTR_NAVIGATION.E0100.sjs/////////////////////////////////

del("X[IMAGE_CONTAINER]");
inputfield([2,1], "Order Type", [2,24], {"name":"z_var", "size":10});
temp = "standard order OR xyz"; // text for searching
set("V[z_var]","&V[temp]",{"search":"order"}); // set with search option

You can see value returned in the Liquid UI field "Order Type" and also on Cornelius window.

See attachment for screenshots