>>>I currently have a grid and in one of the columns is the control source of ABS(report1.total). Now the file actually reflects a negative and since the grid is eyecandy, it does not change - as you know. Now. I have this other column with a checkbox. When the user clicks on the checkbox, I would like for the column showing the ABS to actually reflect the database value just for this line item. Is this possible?? So when clicked it would show a negative. If the database showed a postive, the column would go unchanged. Thanks in advance@@
>>
>>How about adding a second textbox to that column, which would have the raw controlsource - without the abs(). On checkbox just flip the .dynamiccontrol property of that column to use one textbox or the other one.
>
>is this what you are suggesting? I am very new to using the grid dynamic properties. i assume I would still leave the controlsource of the column the same and set different control values to the actual textboxes, correct? Here is my dynamic code:
>
>IIF(lSetControl=.T.,txtABSTotal.Visible=.T.,IIF(lSetControl=.F.,txtRawTotal.Visible=.T.,txtABSTotal.Visible=.T.)))
I had to play around it a little, but here's what works (in grid's .init):
this.column3.ControlSource="iif(pk%2=1, fkmsg, -fkmsg)"
In my case I had two integers, pk and fkmsg. Translated into yours,
this.column3.ControlSource="iif(lControlField, table.total, abs(table.total))"
Keep in mind that you'd better tie this to a value in the table, i.e. lControlField better be a logical field in the same table. You may use Thisform.lSomeProperty as well, but then it would work for the whole table at the same time, and you'd have to issue a refresh whenever this changes. This expression is evaluated each grid refresh for each visible row in the given column, anyway, so you may have to force a refresh, depending on where your checkbox is, like in this example:
this.column3.ControlSource="iif(EMPTY(thisform.check1.Value), fkmsg, -fkmsg%100)"