Jump to content
Sign in to follow this  
panache

Displaying non-selected items of a checkbox

Recommended Posts

Hello. I have a field "paperwork" that contains a check box value list. An user uses this to check off certain pertinent paperwork as it is received. She wants a report that displays, side by side, reports received vs. reports still pending. My question is: How do I create a field that will display items NOT selected in the "paperwork" value list? Here is a screenshot for your reference:

Thanks in advance.

screenshot.gif

Share this post


Link to post
Share on other sites

There has to a better way but -

Set Field(Pending1) = case(PatternCount(StatusField, "Vacation Packets") = 0, "X","")

will put an 'X' in Pending1 if Vacaion Packets haven't been completed. And so on for the other reports.

Share this post


Link to post
Share on other sites

Here is a solution for you. It uses two fields: Completed_Reports and Reports_Pending. Completed_Reports is just a text field. I set it up to use the value list you listed in your question. Reports_Pending is an unstored calculation that uses the following (fairly ugly) If statements:

If(PatternCount( Completed_Reports, "Vacation Packets" )=0,"Vacation Packets

Reports Pending.zip

Share this post


Link to post
Share on other sites

I find nested Case statements much easier than nested If statements, especially complex ones. And yours aren't nested.

Your solution will work with Case instead of If.

By the way, I think you need a "

Share this post


Link to post
Share on other sites

I've always been a little sketchy when it comes to nested case statements, so my solution used ordinary "If" statements. I tried to use one Case statement originally, and it just returned the first matching value. Essentially, instead of this

Case(PatternCount(Completed_Reports,"Vacation Packets")=0,"Vacation Packets","") & "

Share this post


Link to post
Share on other sites

I like the way you remove the left hand items. Not sure if that is what Panache wanted. (Are you still there , Panache?)

Our Case and If solutions are identical (except mine's better smile.gif).

A nested Case will only return one value as a rule - same as nested Ifs.

In every other language I've ever looked at, the BIG difference between Case and If is that If is sequential - it tries each test in turn, starting with the one you coded first - while Case provides no guarantee of sequence. In FMP, however, I'm told Case is sequential also. Hence the only difference is that nested Cases are easier to read - I think.

Share this post


Link to post
Share on other sites

I wonder how readable the calc would be if you were to deal with related lists or some longer custom lists.

Repeating field could be an alternative for long custom lists, prior to FM7 solutions.

See attached a small example.

As this was also covered some days ago, you may also have a look to some other samplers provided here on this list.

-Vaughan's portals

-Using GetField() limited to one way checks

Which method you'd be using would probably depend upon the number of values, and if you'd re-use the available list afterwards (as a list, which therefore means it has to be stored or scripted).

Availables.fp5.zip

Share this post


Link to post
Share on other sites

Grrrr... frown.gif I'm working from home for a week, and don't have FM, but I want to know how to do longer lists! No trial and error for me!

Paul

Share this post


Link to post
Share on other sites

This particular calc is quite readable for virtually any length list. It is simply one line per value. I've seen plenty worse.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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