Give this a try:
DCBROWSECOL ELEMENT 6 HEADER "Qty" PARENT oBrowse;
ID 'FIRST';
EDITOR 'IQTY';
PICTURE {||svc_test(cVar)};
WIDTH 8
-----------------
function svc_test(cVar)
LOCAL ret_val := '99999'
if at(cVar,'HRS;HR ')>0
ret_val:= '99999.99'
endif
return ret_val
Picture in dcbrowseol
Re: Picture in dcbrowseol
But where is it defined?BruceN wrote:cVar is the item type that gets sent to the function to determine if it should be decimal or not.
Re: Picture in dcbrowseol
I don't have cVar in my actual code; what is actually passed is editArray[nchoice,16], but I replaced it in the sample with cVar because it was easier to type
and irrelevant as long as the value being passed was correct (and it is).
I have tried the suggestions and a few other things I could think of ... what always happens is the picture clause for the entire column is being set/changed based on the following:
When you first come into the grid, it uses the picture setting from the first item in the grid; if it is a service item, all items in the column show with decimals; if it is not, then they all show 99999. Then if I edit one of the items, the picture setting for the entire column will change to match the picture setting for that line ... so if it is a service item, all lines will be decimal and it if is a regular item, then all items go to 99999.
The bottom line is the picture clause is being read and reevaluated based on the item, but then it is setting the picture for the entire column and not just the cell. My goal is to be able to have this evaluated for each cell in the column so that they can display differently based on the item type.

I have tried the suggestions and a few other things I could think of ... what always happens is the picture clause for the entire column is being set/changed based on the following:
When you first come into the grid, it uses the picture setting from the first item in the grid; if it is a service item, all items in the column show with decimals; if it is not, then they all show 99999. Then if I edit one of the items, the picture setting for the entire column will change to match the picture setting for that line ... so if it is a service item, all lines will be decimal and it if is a regular item, then all items go to 99999.
The bottom line is the picture clause is being read and reevaluated based on the item, but then it is setting the picture for the entire column and not just the cell. My goal is to be able to have this evaluated for each cell in the column so that they can display differently based on the item type.
There are only 10 kinds of people - those who understand binary and those who don't 

Re: Picture in dcbrowseol
Maybe the following will help.
I think that the picture can't be set by cell.
Code: Select all
dcbrowsecol data {|| if(DC_GetColArray(16,oBrowse)$"HR HRS",str(DC_GetColArray(6,oBrowse),7,2),str(DC_GetColArray(6,oBrowse),8) ) }
Re: Picture in dcbrowseol
If the picture clause doesn't work then try using Transform() in the data code block.
Example:
Example:
Code: Select all
DCBROWSECOL DATA {|c|c := aData[2,oBrowse:arrayElement], Transform(c,IIF(SvcTest(c),'99999.99','99999'))}
The eXpress train is coming - and it has more cars.