I am new to Sequel Viewpoint scripting but not to SQL. What would be the syntax to capture the count of records in a "QTEMP" file created by a view, and then use that record count as the counter in a DOWhile loop.
My goal is to use the record set count to perform a calculation on the current record. Store the results into a new temporary table to use in another view.
My QTEMP table has an encounter number, start date, and end date. There are 178 records in the record set. I need to select the encounter# and store it to the variable &enc. Next I determine the month and year of the start date to &byr and &bmnth. Same with the endate, &eyr and &mnth.
If the start date year and month are the same as end date year and month, store the duration of days in a variable based on the &byr and &bmnth.
If the they do not match, I have to get the difference between the start date and the start date's end of month. Then get the difference between the end date beginning of the month and the end date.
Here is an example:
Result - &201906 = 5
&201906 = 6
&201907 = 2
Any help is greatly appreciated