Panorama normally performs automatic calculations when you enter data. However, I had a user send in an email requesting the ability to perform automatic calculations on command, even if data was not entered. For example, the value of a lookup( formula might change even if no data had been entered in the current record (because of changes made in the database being looked up into).
I was able to come up with a one line program that will automatically run all of the automatic calculations for the current record.
Notice that this doesn’t run any automatic code that has been set up, only automatic formulas.
I’m not sure if adding a menu command for this would be a useful feature, or just added clutter for most users. I imagine different users on here would have different opinions about that. In the mean time, if you need this feature, just use this one line program.
If you are curious about how this program works, replace the execute statement with a displaydata statement.
I’ve been using the Run Automatic Calculations Wizard for years and years, but don’t find that wizard or equivalent in PanX. Does your one-line program do this?
There are two statements that start calculation of automatic formulas or running automatic procedure code — for the active field, not just for a single active record.
So you just need to loop through your fields (and not through thousands or millions of records) to trigger all automatic formulas and field code in your database:
local n, max
n = 1
max = info("fieldcount")
firstcolumn
loopwhile n <= max
runfieldcalculations
runfieldcode info("fieldname")
right
n = n+1
endloop
I’m sorry, I guess the documentation is not clear enough. The runfieldcalculations and runfieldcode statements operate only on the active record, not on all selected records. You would have to loop over all of the records if you wanted to re-calculate all of the records.
Then this is a modified procedure that loops through all records and triggers all automatic formulas and procedures for every field. I tested it with a database with 70 fields and 80 visible records.
// Run all automatic formulas and automatic procedures
local n, max
n = 1
max = info("fieldcount")
firstrecord
loopwhile not info("eof")
firstcolumn
loopwhile n <= max
runfieldcalculations
runfieldcode info("fieldname")
right
n = n+1
endloop
n = 1
downrecord
endloop