Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

So this is kind of simple, but I can't make it work: I have three fields that I want to be filled according to number of characters: field 1 gets the largest number of characters and field 3 gets the smallest.

I have a script that works for fields 1 and 3, but the middle-value field won't work.

To fill fields 1 and 3, I'm saying

If [Length ( db::sourceField2 ) > Length ( db::sourceField1 ) and Length ( db::sourceField3 )]

Set Field [db::fieldText1; db::sourceField2]

Else If [Length ( db::sourceField3 ) > Length ( db::sourceField1 ) and Length ( db::sourceField2 )]

Set Field [db::fieldText1; db::sourceField3]

Else

Set Field [db::fieldText1; db::sourceField1]

End If

To fill field 2, I can see that I need to choose either the middle length or the source field that hasn't been used yet. But FM doesn't seem to like long expressions of greater thans and less thans

(e.g. I tried, if length(sourceField1 ) > length(sourceField2 ) > length(sourceField3 ),

If [Length ( db::sourceField1 ) > Length (db::sourceField2 ) and Length ( sourceField2 ) > Length ( sourceField3 )

and I also tried

If [Length ( sourceField1 ) > Length ( sourceField2 ) and Length ( sourceField3 ) and

Length ( sourceField3 ) < Length ( sourceField1 ) and Length (sourceField2 )

to no avail)

and I can't think of a way that works to choose the unused source field. Variables? My idea of

If [db::fieldText1 = db::sourceField1 (x)or db::sourceField2 and db::fieldText3 = db::sourceField2 (x)or db::sourceField1]

Set Field [db::fieldText2; db::sourceField3]

Else If ~

Else

Set Field [db::fieldText2; db::sourceField2]

End If

didn't work. Oddly enough, either of the two above approaches fills the middle field with the smallest-length field.

I've been spinning my wheels, so I hoped someone would see a clear solution.

Thanks!

Posted

How about

f1=

Case(

Length(s1)>Length(s2) and Length(s1)>Length(s3); s1;

Length(s2)>Length(s1) and Length(s2)>Length(s3); s2;

Length(s3)>Length(s2) and Length(s3)>Length(s1); s3;

)

f2=

Case(

Length(s1)>Length(s2) and Length(s1)<Length(s3); s1;

Length(s1)<Length(s2) and Length(s1)>Length(s3); s1;

Length(s2)>Length(s1) and Length(s2)<Length(s3); s2;

Length(s2)<Length(s1) and Length(s2)>Length(s3); s2;

Length(s3)>Length(s2) and Length(s3)<Length(s1); s3;

Length(s3)<Length(s2) and Length(s3)>Length(s1); s3;

)

f3=

Case(

Length(s1)<Length(s2) and Length(s1)<Length(s3); s1;

Length(s2)<Length(s1) and Length(s2)<Length(s3); s2;

Length(s3)<Length(s2) and Length(s3)<Length(s1); s3;

)

Posted

So this is kind of simple, but I can't make it work: I have three fields that I want to be filled according to number of characters: field 1 gets the largest number of characters and field 3 gets the smallest.

For what purpose?

Posted

Oops, that fails if two sources are the same length.

Thanks! I can work with that!

For what purpose?

A bunch of people submitted a bunch of comments for a bunch of files. I have a layout that has to fit that info and more on a page in a portal. I could save space if I had just one big text box for the longest comments rather than three big ones with a lot of white space in between.

Posted

A bunch of people submitted a bunch of comments for a bunch of files.

OK, that would be a bunch of records, right? Which could be sorted by the Length field? Although I am not sure what you mean by "a page in a portal"; why can't you have one big text box for all the comments, using the List() function?

Posted

OK, that would be a bunch of records, right? Which could be sorted by the Length field? Although I am not sure what you mean by "a page in a portal"; why can't you have one big text box for all the comments, using the List() function?

Well, because I didn't know about the List() fcn. :) That's a much more elegant approach! :D

And yes, they're really records; the records correspond to application files, hence the slip.

And I mean, since there are actually ≤12 comments (with two groups of three, which are the ones I was trying to work with here) * ≤3 reviewers for every record, I need to have a portal big enough to accomodate all that, so the portal takes up most of a page. I want a record (corresp. to an application + all its comments) to span no more than a page, hence my need to condense all the comments.

I hope that makes more sense now and thanks for the suggestion! :thumbup:

This topic is 4655 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
×
×
  • Create New...

Important Information

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