Page 1 of 1

SIML match a set

Posted: Wed Jul 20, 2016 4:41 am
by juantorres
Hi, Im trying to match user user input to a specific set. I have defined a set:

Code: Select all

<Siml>
  <Set Name="ONE">
    <Item>1</Item>
    <Item>ONE</Item>
    <Item>UNO</Item>
  </Set>
</Siml>
How should I reference shuch set to match a pattern in which there are several wildcards, like the following:

Code: Select all

 <Model>
      <Pattern>
        <Item>NUMBER [ONE]</Item>
        <Item>THE NUMBER * [ONE]</Item>
      </Pattern>
      <Response>Selected number <User Set="NUM"><Match /></User></Response>
    </Model>
And I require the user setting NUM to have a VALUE=ONE, any help would be great.

Re: SIML match a set

Posted: Wed Jul 20, 2016 1:36 pm
by Fantom
Match tag will always carry the captured wildcard at the right index. So one cannot change the value it holds at run-time.

Maybe you can use a different approach.

SIML Code

<Model>
  <Pattern>PROCESS NUMBER *</Pattern>
  <Response>The value is <Match /></Response>
</Model>

<Model>
  <Pattern>THE NUMBER * [ONE]</Pattern>
  <Response>
	<Goto>Process number <Match Index="2" /></Goto>
  </Response>
</Model>

<Model>
  <Pattern>NUMBER [ONE]</Pattern>
  <Response>
	<Goto>Process number <Match /></Goto>
  </Response>
</Model>

Re: SIML match a set

Posted: Thu Jul 21, 2016 6:17 pm
by juantorres
Thanks for the prompt response. I'll try that approach.