Derivative records
Since version 1.0.3.2 of Windows the derivative record entry is available as options on the tables. This option, in practice informs the program that in the phase of opening of the card will not have to read the data directly from the table, but, through of its specific values from another.
This mainly serves to overcome one of the constraints of the Nios4 system, namely that each data viewing section can have only one associated table. In fact through this option it will be possible, for example, on an agenda to view together the data derived from a reporting table intervention and maintenance. Opening the data the system will display the card of one or the other, while starting from a section with a single table connected.
Once the option is enabled, you will need to insert a post saving script on all the tables that you want to display inside this one. This script will create the record that will be displayed and set the values that will be used by the system to open the actual tab.
---------------------------------------
--management of Derivative record
---------------------------------------
rowcl = nil
table = database.getsql("SELECT * from activity WHERE tap='maintenance' AND gguidp='" .. dataview.getvalue("gguid") .. "'")
if table.countrows() > 0 then
rows = table.getrows()
rowcl = rows[1]
else
rowcl = database.newdatarow("activity")
end
--I proceed to update the maintenance data on the 'activity
if rowcl ~= nil then
rowcl.setvalue("tap","maintenance")
rowcl.setvalue("gguidp",dataview.getvalue("gguid"))
rowcl.setvalue("start_date",dataview.getvalue("date"))
rowcl.setvalue("expiration_date",dataview.getvalue("xpiration_date"))
rowcl.setvalue("object","maintenance")
rowcl.setvalue("description",dataview.getvalue("client"))
rowcl.setvalue("status","maintenance")
rowcl.save()
database.addsyncbox("activity",rowcl.getvalue("gguid"))
end
--I update the section of the activity with the new maintenance
program.refreshsection("activity")
The necessary values for the correct functioning are the field tap, that identifies the table and the gguidp, that identifies the unique id of the row.