Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

IF function inside a larger calc will not evaluate

Featured Replies

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

  • Author

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.

  • Author

Problem not solved as I thought just a short time ago. Still puzzled by my original question.

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?

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

  • Author

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.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.