The Gardener Posted January 17, 2006 Posted January 17, 2006 Hello, I am puzzled as to why this calculation will not fully work. It is a calc to format an address label. It is in fact taken from a file by Kevin Franks re:address formatting. It works, except for the If function I inserted into the calculation. Here is the calculation: Label: unstored, text Case (IsEmpty ( Organization ) ; "";Trim ( Organization ) & ¶ ) & Trim( First Name) & " " & Trim( Last Name ) & "¶" & Trim( Street Address ) & "¶" & Case( not IsEmpty( International_Addressing::city_line ); Trim(Evaluate( International_Addressing::city_line )); Trim( City ) & ", " & If (State = provinces states counties::province name ; provinces states counties::province name abreviation ; "" ) & " " & Trim( Zip ) & Case( not IsEmpty( Trim( zip_2 )); "-" & Trim( zip_2 )) ) & "¶" & Trim( Country ) This is the If function I inserted: If (State = provinces states counties::province name ; provinces states counties::province name abreviation ; "" ) What it does is; if the state field = the same name in the province name field on the provinces states counties table, it takes the abreviation. For example: I type 'Alberta' into the State field and the If function inside the Label calc should return 'AB'. But what happens is, the function returns 'Alberta'. If I take this function out of the calc and put it a field of it's own , it works. I changed it to a case function,but that changed nothing. Advice to solve this will be greatly appreciated
The Gardener Posted January 17, 2006 Author Posted January 17, 2006 Problem solved. Finally, after a break, I saw that what I missed was that the State field part of the Evaluate calc, which I did not explain in my previous post. Obvious now. Go to: http://www.kevinfrank.com/demo-files-78.html and check out the International Addressing demo. It is excellent.
The Gardener Posted January 17, 2006 Author Posted January 17, 2006 Problem not solved as I thought just a short time ago. Still puzzled by my original question.
SlimJim Posted January 17, 2006 Posted January 17, 2006 This is not a resolution just a few remarks since you seem to be working on your own here. Your If calculation should return either an abbreviation or nothing so how does it return Alberta? To me that seems to indicate that the If is not being evaluated. So go back a step and check out the Case function. This part of the case is evaluated if the international_Addressing::city_line is empty could the problem be here?
Breezer Posted January 18, 2006 Posted January 18, 2006 I thought you said problem solved?: Make sure your relationship "provinces states counties" has the following key: State::province name Once that is set, your calculation should work, if it doesn't, then you ahve a type mismatch. Make sure your state and province name are both TEXT. State = provinces states counties::province name ; provinces states counties::province name abreviation
The Gardener Posted January 18, 2006 Author Posted January 18, 2006 Thanks for the replies. I now can say that I have achieved my objective. I finally realised that I was putting my If functionto get the Province/State abreviation in the wrong place. The place for it is inside the calc the evaluate function processes. Evaluate is quite the function. First time I have even looked at it.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now