Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3990 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted
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 )
)
)
Posted

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

Posted

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...
Posted

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.

This topic is 3990 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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