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

I am working with INT and MOD functions to generate receipts.

 

For example an amount splitted into 5 receipts.

The first 4 have the highest integer and the 5th has the remainder.

 

What I would like to accomplish is to show through a portal a calculation field with the result.

 

I have made a sample file to explain my idea.

 

As always, thank you very much for your help.

NumberOfReceipts.zip

The following calculation assumes that you always generate the receipts via script in the given order and there are no more than two distinct values; it also takes into account the scenario where all receipts are for the exact same amount, or when there is only receipt. (IMO, all this is easier to take care of in a recursive CF …) 
 
In Customers, create a calculation field as
Let ( [
cnt = Count ( Child::Amount ) ;
theFirst = Child::Amount ;
theLast = Last ( Child::Amount ) ;
isSame = theFirst = theLast ;
cntOne = Case ( isSame ; cnt ; cnt - 1 )
] ;
List (
cntOne & Case ( cntOne > 1 ; " receipts " ; " receipt " ) & "à $" & theFirst ;
Case ( not isSame ; "1 receipt à $" & theLast )
)
)
  • Author

Sorry for the "gap", I've been a bit busy.

 

Wow, the Let function is still a bit complicated for me, I'm trying to work on it.

 

I have made some changes in the sample file because it was ill-designed (I tried to make it simple and I did it wrong).

 

 

Working with your advice I'm still not able to make work two things, to filter the portal by customer ID, and to make your let function work individually by customer ID, now it works but it returns the first amount and the last one, but of all receipts of that record.

 

As always thank you for your great help.

NumberOfReceiptsV2.zip

Sorry for the "gap", I've been a bit busy.

 

Aren't we all …?  :getlost:

 

Your file lacked a Receipts TO that was uniquely bound to a ClientParent combination. It should now work as expected.

 

I've added a script/button that lets you select one or more customers to filter the portal and gives some visual feedback. Hope this gets you going for further endeavors …

NumberOfReceiptsV2_eosMOD.fmp12.zip

  • 2 weeks later...
  • Author

Thank you very much Eos, your idea goes even beyond mine.

You saw further problems I didn't spect.

As always incredible help from you.

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.