Community

FC for Invoice currency detection

Hi 

I use FC for invoice, and try to capture only currency, but it seems difficult because the amount and the currency are very close to each other. The amount and currency look like this: USD236,000

I want to separate them to its own field such as currency field (USD)and amount field(236,000). 

Does anyone know any good ideas/ tips to detect only currency? 

I tried replacing USD with "" (space), the options in the data tab in document definition, and creating an element in FCLayout. 

 

Any ideas?

Was this article helpful?

0 out of 0 found this helpful

Comments

4 comments

  • Avatar
    Permanently deleted user

    Hello,

    You may filled Amount and Currency fields by script rule. Also please make sure that datatype of these fields customize correctly

    0
  • Avatar
    Permanently deleted user

    Hi 

    Could you describe about the currency script rule more detail? 

    Do I need to write some script to separate currency and number?

    0
  • Avatar
    Ilya Evdokimov

    In FCI USA there is already a script rule called "Separate currency from amount in Total field" in the field Total.  It also sets the Currency field.  Here is the default rule:

    //CurrencyHelper is declared in Rule Global Script Module

    string[] possibleCurrencies = CurrencyHelper.getpossibleCurrencyValues();

    string amountValue = Context.Field( "Field" ).Text;

    string newAmountValue = amountValue;

    string currencyValue = "";

    foreach( string currency in possibleCurrencies )

    {

        if( amountValue.StartsWith( currency, System.StringComparison.InvariantCultureIgnoreCase ) )

        {

            newAmountValue = amountValue.Substring( currency.Length ).Trim();

            currencyValue = currency;

            break;

        }

        if( amountValue.EndsWith( currency, System.StringComparison.InvariantCultureIgnoreCase ) )

        {

            newAmountValue = amountValue.Substring( 0, amountValue.Length - currency.Length ).Trim();

            currencyValue = currency;

            break;

        }

    }

     

    if( currencyValue != "" )

    {

        if( Context.Field( "Currency" ).Text == "" )

        {

            Context.Field( "Currency" ).Text = currencyValue;

        }

        Context.Field( "Field" ).Text = newAmountValue;

    }

    0
  • Avatar
    Permanently deleted user

    Thank you so much. 

    0

Please sign in to leave a comment.