Subject Re: Calculated Field Question
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Mon, 28 Nov 2022 11:34:52 +0530
Newsgroups dbase.getting-started

Good Morning Norman,

>         I am trying to transfer and use the values of calculated fields ftpmt and stpmt which are generated in pushbutton1 for use in pushbutto2. The values check out OK at the end of pushbutton1, but at the beginning of pushbutton2 the values should be 997.95 and 0 but are an extraneous 5.11 and an inverted 997.95. The ftpmt and stpmt  entryfields are included in the Table and data linked.
>
> The calculated fields are not shown as rows in the Table and apparently cannot be saved as I tried. They are shown on the Form as non enabled entryfields.
>
> I even tried Using m->ftpmt and m->stpmt stored as public variables temftpmt and temstprt in pushbotton1 to be retrieved for pushbutton2. This did not work, the results printed out a 0   0.
>        
>                End of Pushbutton1
>          
>                ? m->ftpmt, m->stpmt
>         
>                 form.lqactsch1.rowset.fields["ftpmt"].value = m->ftpmt         
>                 form.lqactsch1.rowset.SAVE()
>                 form.lqactsch1.rowset.fields["stpmt"].value = m->stpmt
>                 form.lqactsch1.rowset.SAVE()
>                 temftpmt = m->ftpmt
>                 temstpmt = m->stpmt
>         

I am assuming that you have added the calculated field in the sql whle
creating the rowset.

Calculated fields are there in the rowset only and not in the table. So
you probably cannot edit them.

If you want to add calculated fields (based on values stored on some
other fields) You may want to have a look at addField() and
beforeGetValue().

The notation m->ftpmt is used by dbase to access fields when using xdml.
It is not for public variables.

If you want a public variable then you will have to declare it as public

public m

now m will be public and can be of any type. Character integer etc. etc.

m = new object()

Will declare m as a custom object and then you will be able to assign value

m.ftpmt =___________

Regards
Akshat