Automatically calculate sequence within group |
9/17/2019 5:27:10 AM |
PHPRunner General questions | |
P
pmuckle authorDevClub member
Hi, |
|
![]() |
Sergey Kornilov admin 9/17/2019 |
Instead of using a default value I would suggest performing this calculation in BeforeAdd event. $values["Image_sequence"]=<your next number>; |
C
|
Corrie 9/18/2019 |
Hi, I have grouped records with an independent 'sequence' field. The first record for each group starts with sequence '1'. On Add Record, how can I check for the highest sequence number in the group, add +1 and enter it as the default? I'm not sure where in Events I should put the code, or what the code should be... The incomplete sql I have looks something like this: // get highest sequence number for group select Image_sequence, max(value) AS current_seq from Project_photos where Harnessing_project_ID= // update new record with highest number +1 Update Project_photos set Image_sequence=current_seq+1 where Image_ID= Thanks for any pointers Peter
|