Community

FlexiCapture Split Field Script

I'm currently trying to split and reverse a captured field in FlexiCapture.

I have a script but I can't get the actual functions I need to work!

Functions that I'm trying but get the 'xxx is not declared. It may be inaccessible due to it's protection level' are:

Left

Right

Mid

Split

Join

 

Any help would be much appreciated! 

Was this article helpful?

1 out of 1 found this helpful

Comments

2 comments

  • Avatar
    Scott Chau

    Where are you writing this script?  Here is an example of a script I used in the rules.  This seem to work fine for me in VB Script.  You can see its using Len.  Can you send attach a screenshot of your error message?

     


    me.Field("FileName").Text = Right(me.Field("OriginalFile").Text, Len(me.Field("OriginalFile").Text) - InStrRev(me.Field("OriginalFile").Text, "\"))

    0
  • Avatar
    Martin Alabaster

    Chris,

    Edit the document definition. On the field properties select  Autocorrect options, use script and edit the script in your favourite language

    IValue is passed into the script and you can select VB to get mid left and right.

    If you need access to other field values,  document definition -> Edit->Event Handlers tab. Click on After Document State Changed event and edit the script. Choose your script language, I've only ever used c#

    fields are referenced like this (table fields format is a bit tortuous)

    Document.Field("Invoice Layout\\Vendor\\Name").Text

    in c# you can use Document.Field(name).Text.Substring(start,length) or choose VB.and you have left mid etc.

    The script is passed two objects; Document and ChangedStates. The script fires for each changed state, so it can fire more than once.

    state recognition = 2 and you can filter to work just after recognition with (in c#)

    if (!ChangedStates.Has(2))

    {

    return;

    }

     

     

    0

Please sign in to leave a comment.