If statement Fieldcode add a new fieldcode the result Errors

diana
3StarLounger
Posts: 279
Joined: 01 Jun 2010, 00:27

If statement Fieldcode add a new fieldcode the result Errors

Post by diana »

My if statement fieldcode works.

{ If {DOCVARIABLE cms_assign_empl_name} = {DOCVARIABLE cms_resp_ptr_name} "" { DOCVARIABLE cms_assign_empl_rate \#$,##0.00 \*charformat } }


I update the fieldcode. To replace the text dollar symbol $, I add a new fieldcode which displays international currency codes from the database system {cms_currency_symbol}

{ If {DOCVARIABLE cms_assign_empl_name} = {DOCVARIABLE cms_resp_ptr_name} "" { DOCVARIABLE cms_currency_symbol \* charformat } { DOCVARIABLE cms_assign_empl_rate \#,##0.00 \*charformat} }


The results
The data values now don’t display. only the new fieldcode data displays which is the correct currency symbol.

What am I doing wrong.
Is my syntax wrong.
Do I need to add the new fieldcode cms_currency_symbol and cms_assign_empl_rate into curly brackets

TIA

--dd

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: If statement Fieldcode add a new fieldcode the result Er

Post by Rudi »

It seems your IF statement has too many arguments:

Your current format has 3 arguments:

If {DOCVARIABLE cms_assign_empl_name} = {DOCVARIABLE cms_resp_ptr_name}
     (1) ""
     (2) { DOCVARIABLE cms_currency_symbol \* charformat }
     (3) { DOCVARIABLE cms_assign_empl_rate \#,##0.00 \*charformat}

Try this version:
(I have removed the "" which is the TRUE argument, which now makes the international symbol the TRUE statement and the $ symbol the FALSE statement.)

If {DOCVARIABLE cms_assign_empl_name} = {DOCVARIABLE cms_resp_ptr_name} { DOCVARIABLE cms_currency_symbol \* charformat } { DOCVARIABLE cms_assign_empl_rate \#,##0.00 \*charformat}

Note: I have removed the outer curly braces as this will be added automatically by Word when you insert the field again.
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

diana
3StarLounger
Posts: 279
Joined: 01 Jun 2010, 00:27

Re: If statement Fieldcode add a new fieldcode the result Er

Post by diana »

Thank you Rudi

sorry perhaps I wasn’t clear.

The new fieldcode international currency symbol will now be in front of the empl_rate
ie { DOCVARIABLE cms_currency_symbol \* charformat } { DOCVARIABLE cms_assign_empl_rate \#,##0.00 \*charformat}
eg £400


Ive updated the fieldcode to what you suggested eg
{ If {DOCVARIABLE cms_assign_empl_name} = {DOCVARIABLE cms_resp_ptr_name} { DOCVARIABLE cms_currency_symbol \* charformat } { DOCVARIABLE cms_assign_empl_rate \#,##0.00 \*charformat} }

The result is
only displays the empl_rate


I thought perhaps I need to insert cms_currency_symbol and empl_rate in an one outer curly bracket eg

{ If {DOCVARIABLE cms_assign_empl_name} = {DOCVARIABLE cms_resp_ptr_name} "" { { DOCVARIABLE cms_currency_symbol \* charformat } { DOCVARIABLE cms_assign_empl_rate \#,##0.00 \*charformat } } }

the results
no values displays

User avatar
HansV
Administrator
Posts: 78917
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: If statement Fieldcode add a new fieldcode the result Er

Post by HansV »

How about placing double quotes around the entire "else" part:

{ If {DOCVARIABLE cms_assign_empl_name} = {DOCVARIABLE cms_resp_ptr_name} "" "{ DOCVARIABLE cms_currency_symbol \* charformat } { DOCVARIABLE cms_assign_empl_rate \#,##0.00 \*charformat}" }
Best wishes,
Hans

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: If statement Fieldcode add a new fieldcode the result Er

Post by Rudi »

Sorry... I misread...

I see Hans already answered while I was searching and tested to verify this.... (it confirms his advice)

Try this:
To merge multiple fields simply place the various {MERGEFIELD some_field} strings in double quotes.

If {DOCVARIABLE cms_assign_empl_name} = {DOCVARIABLE cms_resp_ptr_name} "" "{ DOCVARIABLE cms_currency_symbol \* charformat } { DOCVARIABLE cms_assign_empl_rate \#,##0.00 \*charformat}"
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

diana
3StarLounger
Posts: 279
Joined: 01 Jun 2010, 00:27

Re: If statement Fieldcode add a new fieldcode the result Er

Post by diana »

Thank you Hans, thank you Rudi

that worked! :clapping:

So it was incorrect syntax. correction in the syntax worked

many thanks again