Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Wildcards in Rules

Status
Not open for further replies.

Keyser520

Aerospace
Joined
Jul 18, 2012
Messages
1
Location
US
If I want to use a wildcard in a rule, such as :

If PartName==*bolt* Then

How would I do that?

Does it use regular expressions?
 
The wildcard * will not work as it is a valid string character. You can create a reaction to do what you ask.

You need to create a String Parameter String.1 and a Boolean parameter Boolean.1
Create a reaction to fire on ValueChange of String.1

let Name (string)
let Name_len (integer)
let Item (string)
let Result (string)
let Item_len (integer)
let len_diff (integer)
let i (integer)

/* Output */
Boolean.1 = false

/* Assignment */

Name = String.1
Name_len = Name->Length()
Item = "bolt"
Item_len = Item->Length()
len_diff = Name_len - Item_len + 1
i = 0

if Name_len >= Item_len
{
for i while i < len_diff
{
Result = Name->Extract(i,Item_len)
if Result == Item
Boolean.1 = true
i = i + 1
}

}




Regards,
Derek




Win XP64
R20/21, 3DVIA Composer 2012, ST R20
Dell T7400 16GB Ram
Quadro FX 4800 - 1.5GB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top