I have a TabPanel on a form and the TabPanel is set to Table view locked. To the very left of each row in the TabPanel I placed a Details button which a user can click on to see the details of the record. However I can not seem to get to the exact record. I keep getting a random record.
The script I have attached to the Details button is as follows:
//Get record details and place them in globals
globals.gLdr_entity_id = ldr_entity_id;
globals.gCoh_acct = coh_acct;
globals.gCoh_cost_ctr = coh_cost_ctr;
//switch form and perform find
forms.Grant_SubAcct.controller.show();
forms.Grant_SubAcct.controller.find();
forms.Grant_SubAcct.ldr_entity_id = globals.gLdr_entity_id;
forms.Grant_SubAcct.controller.newRecord();
forms.Grant_SubAcct.coh_acct = globals.gCoh_acct;
forms.Grant_SubAcct.controller.newRecord();
forms.Grant_SubAcct.coh_cost_ctr = globals.gCoh_cost_ctr;
forms.Grant_SubAcct.controller.search();
I also tried capturing (ldr_entity_id, coh_acct, & coh_cost_ctr) as local variables but received the same results.
I also tried the following code as well with no luck:
var vIndex = controller.getSelectedIndex();
forms.Grant_SubAcct.controller.loadRecords(vIndex);
forms.Grant_SubAcct.controller.show();
The backend is Sybase version is 12.5.3 (on a Unix box).
The driver Im using is com.sybase.jdbc3.jdbc.SybDriver
Database Server URL is: jdbc:sybase:Tds:IpAddress:4100/databasename
Servoy Developer
Version 3.1.5-build 409
Java version 1.6.0_01-b06 (Windows XP)
Setup a global integer variable:
globals.gcurr_TableNameID
Setup a global relationship:
‘gcurr_TablenameID_to_TableName_ID’ using globals.gcurr_TableNameID → TableName_ID
Then attach a method the the Detail button:
globals.gcurr_TableName = dr_entity_id // set the global variable
forms.Grant_SubAcct.controller.loadRecords(gcurr_TablenameID_to_TableName_ID) // load the one record that is required
Depending on how the Details form works with other forms you may need to set it to ‘useSeperateFoundset’.
//switch form and perform find
forms.Grant_SubAcct.controller.show();
forms.Grant_SubAcct.controller.find();
forms.Grant_SubAcct.ldr_entity_id = globals.gLdr_entity_id;
forms.Grant_SubAcct.controller.newRecord();
forms.Grant_SubAcct.coh_acct = globals.gCoh_acct;
forms.Grant_SubAcct.controller.newRecord();
forms.Grant_SubAcct.coh_cost_ctr = globals.gCoh_cost_ctr;
forms.Grant_SubAcct.controller.search();
This code performs an OR search because you are adding a new find request for each criteria and I get the impression that you need to have all 3 fields in a single search request. So could this be causing the inconsistent find result ?
var vIndex = controller.getSelectedIndex();
forms.Grant_SubAcct.controller.loadRecords(vIndex);
forms.Grant_SubAcct.controller.show();
You are launching this from the parent form and so the controller.getSelectedIndex will pick up the index of the parent form record. You should change this to :forms.Grant_SubAcct.controller.getSelectedIndex();
But how are you then viewing the record that you have loaded ?
Are you changing the main form to that of the related record and viewing it there or are you loading it in a form in dialogue to view it ?