Community

Decide what value to take...

Hello,

im new to the fexCap forums, HELLO ALL.




I have a document with 2 fields for customerid's, if the first field is filled, i need to take first cust.-id, if not, i need to take the second.
Ontime i have 2 static text elements and 2 character string elements related to them. All elements are consolidated in a group element.
Finally, i want to have the value in a blockelement.

Can i make a script that makes the decision based on value of field one? If yes, how and where?
Can i make a FirstFound-Element based on character string element (with regular expression)?


Thank you in advance.

Kind regards, Thomas

Was this article helpful?

0 out of 0 found this helpful

Comments

1 comment

  • Avatar
    Katja Ovcharova
    Hello, Thomas.

    Let's say you have two character string elements, e.g. id_1 and id_2. To take the first filled value you could try the following approach.

    1. Create the new Region element in the Group element.
    2. In the Advanced tab of the Region element properties add the following script to Advanced pre-search relations:
    //if the first id is filled, take its region
    if (id_1.IsFound) then rsa : id_1.Rect.GetInflated(5dt, 5dt); //inflated region is better to recognize later in FlexiCapture
    //if the first id is empty, but the second is filled, take the region of the latter
    else if (id_2.IsFound) then rsa : id_2.Rect.GetInflated(5dt, 5dt);
    //if none of them is filled, define empty region
    else DontFind();
    3. Set this Region as a source element for the corresponding Block element.

    You could also try using the First-Found element, but the way described above is more reliable.
    0

Please sign in to leave a comment.