Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Displaying non-selected items of a checkbox

Featured Replies

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

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.

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

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 "

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","") & "

Here's a similar solution that keeps the order of the list as well as the spacing. Thanks!

Paul

Revised Report.zip

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.

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

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

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

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.