Jump to content

Case Statement with three results.


This topic is 5693 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have this script that I built in FM Dev 6. This script is put on a calculation field that is a container.

Case( PatternCount( SortField, "LastName¶" ),

GetRepetition( SortPicture,

If( MiddleWords( SortDirection,

PatternCount( Left( SortField, Position( SortField, "LastName", 1, 1 ) ), "¶" ) + 1, 1 ) = "Ascending", 1, 2 ) ) )

Basically what I need is,

If SortField = LastName then

If the SortDirection = "Ascending" then put in the 2nd picture from the SortPicture container.

If the SortDirection = "Descending" then put in the 1st picture from the SortPicture container.

The default picture has to be the 3rd picture from the SortPicture container.

Link to comment
Share on other sites

Not certain of your syntax overall, but I'd do it like this in pseudo-code:

If (PatternCount(SortField, "LastName¶" );

If (SortDirection = Ascending; Pic2; Pic1);

Pic3

);

I think it's simpler.

David

Link to comment
Share on other sites

But it should be

GetRepetition ( Pics ; Case(

Sortfield = LastName and SortDirection = "Ascending"; 2;

Sortfield = LastName and SortDirection = "Descending"; 1;

3))

With the pre fm7 syntax... Because it can't be stressed strongly enough, this is where repeating fields really come in handy and is a "legitimate" use of this field type - Since this is far from 1NF violations.

--sd

Link to comment
Share on other sites

This topic is 5693 days old. Please don't post here. Open a new topic instead.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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