I am adding multiple tabs from multiple new forms at runtime. For each tab I create a new relation with a unique name. The display of the tab seems to works correctly-> the related records display
When I loop through the tabs later in the program the get tab relation funtion returns null
Even if I try to get the relation name immediately after the addTab, I get a null.
What is ntabnum in your example?
When the value is larger then the number of existing tabs, the tab will be added at the end, so not at the requested position.
For example if you have 1 tab and you add a tab on position 5 it will be added to position 2
getTabRelationNameAt(5) will return null.
Note that the index is 1-based, so index 1 refers to the first tab, not the second.
Hi Rob,
ntabnum is the tab I am at
I don’t think this is the issue as the getTabNameAt returns the correct tab name.
i have done further testing and the relation is simply not being attached to the tab at all.
Here is the code I am using for the relation setting. Maybe it is something in here:
_datasource = the main table on the form
uri is a temporary datasource. I have verified and the values are set correctly.
var crelname = application.getUUID().toString()
var rel = solutionModel.newRelation(crelname,_datasource,uri1,JSRelation.INNER_JOIN)
rel.newRelationItem('itemid','=','itemid')
elements['tabacc'].addTab(_form,ctabname,ctabname,null,null,'#000000','#BBCCEE',rel,natnum)
where _form is the new form on the tab and all records in the table I just created show on the tab not just the foundset based on the relation with the main form
Do I need to reload something from the main form as well to force the relation to be respected?
I dont know what kind of form you put on the tab, but normally you dont have to do recreateui or load records. If the relation is created correctly it should show the correct data on the tabform.