FMPRO-L Archives

May 2012, Week 2

FMPRO-L@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Jonathan Fletcher <[log in to unmask]>
Reply To:
FileMaker Pro Discussions <[log in to unmask]>
Date:
Mon, 14 May 2012 11:53:10 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (54 lines)
On May 14, 2012, at 11:13 AM, John Montana wrote:

> I have an app with 110+ check boxes where I need the same result.
> That would need 2*n+ fields....


Oh, you're right that would be cumbersome.

One of a few ways that I can think to approach it that would require far fewer fields:

A looping script. You could loop through the found set and collect the counts one at a time:

Go To Record [ First ]
Loop
	SetVariable [ $count_1 ; Value: Case ( ValueCount ( chckBoxField ) = 1 ; $count_1 + 1 )
	SetVariable [ $count_2 ; Value: Case ( ValueCount ( chckBoxField ) = 2 ; $count_2 + 1 )
	SetVariable [ $count_3 ; Value: Case ( ValueCount ( chckBoxField ) = 3 ; $count_3 + 1 )
	 ...
	SetVariable [ $count_n ; Value: Case ( ValueCount ( chckBoxField ) = 1 ; $count_n + 1 )
	Go To Record [ Exit After Last ; Next ]
EndLoop

Then have a calculation that aggregates your list, skipping the empty ones:

Case ( $count_1 ; $count_1 & " record(s) with 1 box checked¶" ) &
Case ( $count_2 ; $count_2 & " record(s) with 2 boxes checked¶" ) &
Case ( $count_3 ; $count_3 & " record(s) with 3 boxes checked¶" ) &
 ...
Case ( $count_n ; $count_n & " record(s) with n boxes checked¶" )

[Note: Case ( $count_1 ; … ) is the same thing as Case ( $count_1 > 0 ; … ) because the boolean logic says that there are only two kinds of results, zero and non-zero. So there is either a non-zero number in that variable or there isn't. If that looks unintuitive to you, you can put the "> 0" in if you want.]

This is another simple, but "brute-force" approach to your need. Another approach would be to employ a recursive custom function and a few levels of abstraction. That would require more thought, could be more "elegant," but this should get you there.

j.



--
Jonathan Fletcher
FileMaker 9/10/11 Certified Developer

Fletcher Data Consulting
[log in to unmask]
http://www.fletcherdata.com
502-509-7137

Personal Blog o'Stuff: http://jfletch.posterous.com

Kentuckiana's FileMaker Users Group
Next up: Build-from-scratch and more Twelve!
Tuesday, May 22, 12:00 pm to 3:30-ish
Blog: http://www.kyfmp.com

ATOM RSS1 RSS2