Where are you using this, in a script with Set field, or in the field definition of a calculated field?
To start with, have a look at the Case function: http://fmhelp.filemaker.com//help/15/fmp/en/#page/FMP_Help%2Fcase.html.
it's the field definition of a calculated field, thanks!
A Case() function would be better here. Also, if you want to "auto-enter" the value in Account_Nbr, you don't specify it in the calculation (of the field)
( Charge_to = "Royalty Advance: Trade Items " ; "1-10-10-1350-000-0000-00"
; Charge_to = "Royalty Advance: Parish Items " ; "1-10-10-1350-000-0000-00"
; "" // the final-default value can be empty or anything you wish.
Your results, such as
Account_Nbr = "1-10-10-1350-000-0000-00"
will evaluate as 1 (true) or 0 (false).
If this is the definition of Account_Nbr, just put the value (i.e. "1-10-10-1350-000-0000-00" ). The whole expression is what "Account_Nbr" will "=".
And yes, check out the Case function. I also have a blog about it here: http://extensitech.com/the-case-for-case/
The Account_Nbr = "1-10-10-1350-000-0000-00" part in your calculation doesn't assign a value to Account_Nbr. In this context it is giving a true/false answer.
The If() expression would be written as
If ( Charge_To = "Royalty Advance: Trade Items"; "1-10-10-1350-000-0000-00";
... [the false results would go here]
but it is definitely easier to write and debug using a single Case() statement.
Either way you need the calculation to be used in some context that assigns its result to Account_Nbr,
Like he said.
this is hardcoding.
Build a reference table, go get the related value, that's it.
+1 for SIPLUS comment.
thanks for taking a look and letting me know what i did wrong lol.
Knowing how to use a Case statement is an important skill.
So you're getting some helpful advice on that subject.
But - that is absolutely the wrong approach. Do not use a calculation for this.
You should not need to go into field definitions to add or modify correlations between Charge_to and Account Number.
That's the lesson to learn here.
re-download the example... I'm tired
lol = "laugh out loud" ; "should I take your question seriously?"
; lol = "lots of love" ; "are you being cheeky?"
; lol = "little old lady" ; "now come on!"
; "next question"