Ok, here a sample of the TmpTable, the Class and the Form.
This is just to concentrate on the question.
In real there’s alot other different stuff going on of course
Created a TempTable cdtyTable with fields
id (int), bid(real), ask(real)
Table has a find method:
static CdtyTable find(int _Id,
boolean update = false)
{
CdtyTable CdtyTable;
;
CdtyTable.selectForUpdate(update);
if (_Id)
{
select firstonly CdtyTable
// index hint RecIdIdx
where CdtyTable.Id == _Id;
}
return CdtyTable;
}
Created a Class cdtyClass with:
class CdtyClass
{
CdtyTable CdtyTable;
}
public real parmBid(int _id, real _bid = 0)
{
;
if(_bid != 0)
{
select forupdate CdtyTable where CdtyTable.Id == _id;
CdtyTable.Id = _id;
CdtyTable.Bid = _bid;
if(CdtyTable.RecId) CdtyTable.update();
else CdtyTable.insert();
}
return CdtyTable::find(_id).Bid;
}
public real parmAsk(int _id, real _ask = 0)
{
;
if(_ask != 0)
{
select forupdate CdtyTable where CdtyTable.Id == _id;
CdtyTable.Id = _id;
CdtyTable.ask = _ask;
if(CdtyTable.RecId) CdtyTable.update();
else CdtyTable.insert();
}
return CdtyTable::find(_id).ask;
}
Created a Form cdtyForm
public class FormRun extends ObjectRun
{
CDTYClass cdty;
}
public void init()
{
super();
cdty = new CDTYClass();
}
and a method:
void showValues()
{
;
info(strfmt("%1", num2str(cdty.parmBid(1),1,4,1,0)));
cdty.parmBid(1,1.2345);
info(strfmt("%1", num2str(cdty.parmBid(1),1,4,1,0)));
cdty.parmBid(2,2.3432);
info(strfmt("%1", num2str(cdty.parmBid(1),1,4,1,0)));
info(strfmt("%1", num2str(cdty.parmBid(2),1,4,1,0)));
cdty.parmAsk(3,3.3333);
info(strfmt("%1", num2str(cdty.parmAsk(3),1,4,1,0)));
cdty.parmAsk(4,4.4444);
info(strfmt("%1", num2str(cdty.parmAsk(3),1,4,1,0)));
}
Also a button on the form, when clicked runs method showValues.
This way I can emulate insert, update and read values from te cdtyTable but per ID.
I would expect when clicking the button on the form:
Info Bericht (12/1/2019 - 11:29:00) 0.0000
Info Bericht (12/1/2019 - 11:29:00) 1.2345
Info Bericht (12/1/2019 - 11:29:00) 1.2345
Info Bericht (12/1/2019 - 11:29:00) 2.3432
Info Bericht (12/1/2019 - 11:29:00) 3.3333
Info Bericht (12/1/2019 - 11:29:00) 4.4444
But I only get zeros…
Pls advise