Page 2 of 2

Re: Picture in dcbrowseol

Posted: Thu Jun 24, 2010 9:38 pm
by TWolfe
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

Re: Picture in dcbrowseol

Posted: Thu Jun 24, 2010 10:23 pm
by skiman
BruceN wrote:cVar is the item type that gets sent to the function to determine if it should be decimal or not.
But where is it defined?

Re: Picture in dcbrowseol

Posted: Fri Jun 25, 2010 3:42 am
by BruceN
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.

Re: Picture in dcbrowseol

Posted: Fri Jun 25, 2010 6:52 am
by skiman
Maybe the following will help.

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) ) }
I think that the picture can't be set by cell.

Re: Picture in dcbrowseol

Posted: Fri Jun 25, 2010 7:21 am
by rdonnay
If the picture clause doesn't work then try using Transform() in the data code block.

Example:

Code: Select all

DCBROWSECOL DATA {|c|c := aData[2,oBrowse:arrayElement], Transform(c,IIF(SvcTest(c),'99999.99','99999'))}