The following code produces differing results when it’s stepped through with the debugger.
The variables return vCount1 = 2, vCount2 = 1 if run automatically (the new record is not included in the count). However if stepped through they’re vCount1 = 3, vCount2 = 2 (the new record is included in the count).
Am I missing something here?
// triggered by comUtility.createJoinRecords
// new record safe setup
var vSet = foundset.getSize();
if ( vSet == 0 || vSet == 1 )
{
controller.loadAllRecords();
}
controller.newRecord(true);
sec_sev_id = globals.gsevid;
var vComid = arguments[0];
var vPeoid = arguments[1];
var vComid = 57; // test
var vPeoid = 12; // test
cpj_com_id = vComid;
cpj_peo_id = vPeoid;
controller.saveData(); // mandatory Morley 18Oct2005
globals.gcurrent = vPeoid;
var vCount1 = gcurrentpeoid$to_cpjoin.getSize();
application.output('cpjoinAnalysis.newPair currentpeoid vCount1 = ' + vCount1);
if (vCount1 == 1) // make this the default link
{
peoid$cpj_to_peo.peo_com_id = vComid;
pref_peo = 1;
}
globals.gcurrent = vComid;
var vCount2 = gcurrentcomid$to_cpjoin.getSize();
application.output('cpjoinAnalysis.newPair currentcomid vCount2 = ' + vCount2);
if (vCount2 == 1) // make this the default link
{
comid$cpj_to_com.com_peo_id = vPeoid;
pref_com = 1;
}