I have a model driven app with a embedded canvas app.
The canvas app has one gallery showing existing records in a table called (AFP Payment Schedules) based on a Job Number.
The second gallery I'm using with a collection to enable the user to input information and then I patch that into the AFP Payment Schedules table.
What I'm having a problem with is I'm trying to get last ID number (AFP Number) from the AFP Payment Schedules table, based on the Job Number and then increment ID by one. The second gallery should then be automatically listing the new line of info to be entered with the next AFP number after what already exists. The code I'm trying is below, but what I get returned each time is a zero.
The existing AFP number is 1 so I'm expecting my new line in gallery two to be a 2 as its incremented 1 by 1.
Set(LastTotalAFP_ScheduleLines, LookUp('AFP Payment Schedules', 'Job Number' = [@ModelDrivenFormIntegration].Item.'Job Number').'AFP Number');
Set(TotalAFP_ScheduleLines, LastTotalAFP_ScheduleLines +1);
The collection then incorporates
AFPNumber: TotalAFP_ScheduleLines,
Thanks in advance for any help on this
David