Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

I want to create a field that will display a calculated text result based upon several checkbox fields.

Basically, I have 4 check boxes that can be selected and unselected independent of one another. I want to display a friendly result that will display the name of all check boxes that are checked.

i.e.

field1 = 1

field2 = 0

field3 = 1

field4 = 0

would return "Field1, Field3"

and

field1 = 1

field2 = 1

field3 = 1

field4 = 1

would return "Field1, Field2, Field3, Field4"

What's the best way to do this?

Posted


let(a=field1+field2+field3+field4;

case(a=0;""; a=1 ; case(field1 ; "field1"; field2 ; "field2"; field3; "field3" ; field4 ; "field4");

let(b= if (field1; "field1, ") & if(field2; "field2, ") & if (field3; "field3, ") & if(field4 ; "field4, "); left(b ; length(-2)

)

)

)

It's not clear what he's asking, but that would be an answer, if he means he has four fields where a value of 1 is either checked or unchecked. It's not the shortest way to write, but I think it's the way to write it that would calculate as quickly as possible.

Posted

Something like this:


substitute( GetFieldName ( CheckBox::field1 ) ; "::" ; "" )

Have you actually tried that before submitting it?

It doesn't work. And it doesn't address the problem across the set of fields in the original request.

Posted

Have you actually tried that before submitting it?

Yes i did actually!

Works just fine for me if you have a Table named 'CheckBox' and a field names 'field1' respectively.

Posted

Yes i did actually!

Works just fine for me if you have a Table named 'CheckBox' and a field names 'field1' respectively.

Perhaps test again? ;)

Something like this:


substitute( GetFieldName ( CheckBox::field1 ) ; "::" ; "" )

This would produce CheckBoxfield1

Posted

Why isn't the checkbox assigned to one field? Of course, because I'm Barbara, I will ask, "perhaps you need a join table?"

Posted

Perhaps test again? ;)

This would produce CheckBoxfield1

TO have field1 or field 2 ,etc then this would do making sure fields were named properly such as field1, field2,etc,etc


right( Substitute( GetFieldName ( CheckBox::field1) ; "::" ; "" ) ; valuecount( CheckBox::field1) +6 )

Posted

If all the fields are in the same table then you can use something like:


Let ( tablename = LeftWords ( GetFieldName ( f1 ); 1);

		 Substitute (

							 List ( Case ( f1; GetFieldName ( f1 ) );

									  Case ( f2; GetFieldName ( f2 ) );

									  Case ( f3; GetFieldName ( f3 ) );

									  Case ( f4; GetFieldName ( f4 ) )

								    );

						    tablename & "::"; ""

						   )

	   )

Posted

Nice one.. John.. Detailed , but nice. one. l love it when i post a mistake . i leave some stuff out of whatever i post, every expert is on my butt and all i am trying to do is help someone as best i know.

... Hilarious... :laugh:

Posted

It is not helpful to post untested, non-functioning, misleading responses.

Posted

TO have field1 or field 2 ,etc then this would do making sure fields were named properly such as field1, field2,etc,etc


right( Substitute( GetFieldName ( CheckBox::field1) ; "::" ; "" ) ; valuecount( CheckBox::field1) +6 )

This is - basically - complete nonsense.

Depending on the values in field1 1 this could produce any of the following:

field1 (when field1 is completely empty)

xfield1

oxfield1

boxfield1

kboxfield1

etc.

Further, it is not dependent on whether field1 contains a "1" character.

Further, it misleads from a more appropriate technical solution such as the join table proposed by Barbara.

This topic is 4671 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.