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?
コメント
4件のコメント
Hello,
You may filled Amount and Currency fields by script rule. Also please make sure that datatype of these fields customize correctly
Hi
Could you describe about the currency script rule more detail?
Do I need to write some script to separate currency and number?
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;
}
Thank you so much.
サインインしてコメントを残してください。