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

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

Recommended Posts

Posted

Hi

I have this fonction in a calculation field : "If ( Get ( TotalRecordCount )-Get ( RecordNumber ) >0 ;  "perform record: present - (record +1)")"

what I need is if the current record is not the last then..... take the present value - next record value 

 

I also tried like this but I get "?" on every new record created. If I modify the calculation script then it run the calculation and everything work but for only old records, it s like the calculation run only one time on the creation. 

If ( Get ( TotalRecordCount )-Get ( RecordNumber ) >0 ; GetNthRecord ( FIELD ; Get ( RecordNumber )+1 )-GetNthRecord ( FIELD ; Get ( RecordNumber ) ))

 

maybe I miss something, I don't get why it's not working ?

 

thank you :) 

Posted (edited)

I don't really understand what you're describing. Or why you would need such thing. I would just note that a calculation referencing the next record needs to be unstored. And even if it is unstored, it will not automatically refresh its displayed value when the next record is created/modified. That will happen only if you click into the field, or refresh the window.

Note also that:

4 hours ago, ibobo said:

If ( Get ( TotalRecordCount )-Get ( RecordNumber ) >0 ; GetNthRecord ( FIELD ; Get ( RecordNumber )+1 )-GetNthRecord ( FIELD ; Get ( RecordNumber ) ))

can be simplified to =

If ( 
Get (RecordNumber) = Get (TotalRecordCount) ; FIELD ;
GetNthRecord ( FIELD ; Get (RecordNumber) + 1 ) - FIELD
)

 

Edited by comment
  • Like 1
Posted

Wouldn't such an unstored calc also have different results based on how the table is sorted? And have different results in a found set?

Posted
Just now, OlgerDiekstra said:

Wouldn't such an unstored calc also have different results based on how the table is sorted? And have different results in a found set?

Why yes, of course. Any calculation using Get(RecorNumber) is entirely dependent on the current found set (or related set, if used in portal) and sort order. That goes without saying (at least I didn't think it needed to be said).

And since you point this out, it would probably be best to replace Get (TotalRecordCount) with Get (FoundCount).

Posted

Hi Comment,  thank you :)

maybe a should run a script to calculate that field , I ll do as you update it.

I always come with strange calculation ))))

 

This topic is 2189 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.