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.

Featured Replies

Hi,
 
I tried to make a simple calculation to total up outstanding bills or return some text if all paid.
 
Invoice dates are only created on receiving payment.

If ( IsEmpty ( Finance::date invoice ) ;
 Sum ( Finance::calc_paymentdue ) ; 
"All Bills Paid" )

 

 

It comes back with all bills paid even though there are a number of records with empty Date Invoice fields.

 

Does this look at all related records and if it finds any Date Invoice field with data it returns the text? 

 

Any help appreciated.

Thanks

Filemaker has no SUMIF or COUNTIF functions. Your calculation looks at the first related record: if it has a date, then it sums ALL related records; otherwise it does nothing.

 

One way to solve this problem is to define a calculation field in the Finance table along the lines of =

Case ( not date invoice ; calc_paymentdue )

and sum this field.

 

 

If you only want to "return some text if all paid", then count the date invoice field, and compare the count to count of related records.

Your IsEmpty( ) is only looking at the first related record. Try something like this:

IsEmpty( List( Finance::date invoice ) )
  • Author

Thanks guys for helping me understand this.

 

I ended up creating the calculation field in the finance table. 

Case ( IsEmpty ( date invoice ) ; Sum ( calc_paymentdue );
not IsEmpty ( date invoice ) ; " "  )

 

I ended up creating the calculation field in the finance table. 

Case ( IsEmpty ( date invoice ) ; Sum ( calc_paymentdue );
not IsEmpty ( date invoice ) ; " "  )

 

 

 

That's a pretty convoluted way to write;

Case ( not date invoice ; calc_paymentdue )

Note:  the Sum() function in your formula is "summing" a single local value, therefore it's redundant. So is the second test in the Case() function: if the first test (IsEmpty) is not true, then of course the second test (not IsEmpty) must be true. Why you need a space as a default result is not clear to me.

  • Author

Ok that makes sense. I thought I would need to give the calculation what to do if the result was true. Thanks for clarifying!

  • Author

As this is about the Case function I'll ask here rather than starting a new thread.

 

I have made this calculation:

Case ( 
Stage of Development="Enquiry" ; "1" ; 
Stage of Development="Appointment" ; "1" ; 
Stage of Development="Outline Proposals" ; "1" ; 
Stage of Development="Pre-App" ; "2" ; 
Stage of Development="Planning Application" ; "2" ; 
Stage of Development="Final Proposals" ; "2" ; 
Stage of Development="Working Drawings" ; "3" ; 
Stage of Development="Tender Period" ; "3" ; 
Stage of Development="On Site" ; "4" ; 
Stage of Development="Defects Period" ; "5" ; 
Stage of Development="Completion" ; "5" ; 
"BROKEN"
)

Unfortunately it always come back with BROKEN. I don't understand why it isn't working.  :hmm:

 

You don’t need the quotes on the numbers

What kind of field is Stage of Development?  Checkbox?

What happened to my answer? Which said:
 

 

There is nothing wrong with your calculation per se, so check your data.

 

See your private messages. 

  • Author

Thanks for the responses.

 

Stage of development is a text field with a value list.

 

I removed the quotations and I still have the same problem.

 

 

The value lists matches the results in the Case calculation to the letter and capitalisation - not sure if that matters.

Perhaps I'm not understanding how the Case function works?

 

 

I am trying to give a numerical value to the stage of development to be used in conjunction with a progress bar.

 

Any help appreciated.

Do you still have not described how the field is displayed. Check box? Radio buttons? Dropdown list?

Try placing a copy of the field on the layout and set it to be just a standard text box.

Does it contain returns? Does it contain other values?

  • Author

Sorry I missed that - It is a pop down menu. 

 

I have set both the calculation field and the stage of development field to a standard edit field and it still returns BROKEN.

 

 

There are no returns in the value list and they match exactly the results in the Case calculation. Inputting into the field Stage of Development manually rather than a pop down list also returns BROKEN.

As Comment says; there is nothing wrong with the calc.

 

Sounds like it is time to post your file.

  • Author

Thanks for taking the time Lee.

 

I understand what BruceR was getting at with his questions. In my value list I had managed to include a space at the end of each value.

So not exactly the same!

 

I appreciate all the help. Hopefully I wont make this kind of mistake again. Wishful thinking perhaps. :)

Spaces in Fields, Lists, Relations, etc. names,  will mess you up. Welcome to the world of developing. Don’t worry about making this kind of mistake again, YOU WILL, it is part of the fun.

 

Lee

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.