Picture in dcbrowseol
Picture in dcbrowseol
Is there a way to have a different picture clause for cells in a single column in a dcbrowse? We have a numeric field that sometimes needs to have decimals and other times needs to be integral in both view and edit. Thanks.
There are only 10 kinds of people - those who understand binary and those who don't 

Re: Picture in dcbrowseol
Use the PICTURE '999999.99' clause on the numeric column.
The eXpress train is coming - and it has more cars.
Re: Picture in dcbrowseol
Roger, I don't think you understood what I'm trying to do. I need to have some cells with 99999.99 and some with just 99999 based on the value of another field in the browse which determines whether the item is supposed to be an integer or a decimal, so I need the picture to evaluate the value of the other field in order to know whether it should be 99999.99 or 99999. Can that be done?
There are only 10 kinds of people - those who understand binary and those who don't 

Re: Picture in dcbrowseol
bruce,
try picture {||iif(condition,"999999.99","999999")}
Brian
try picture {||iif(condition,"999999.99","999999")}
Brian
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises
Re: Picture in dcbrowseol
I had already tried a codeblock as follows:
DCBROWSECOL ELEMENT 6 HEADER "Qty" PARENT oBrowse;
ID 'FIRST';
EDITOR 'IQTY';
PICTURE{||iif(svc_test(cVar]),'99999.99','99999')};
WIDTH 8
@ nil, nil dcget xNil GETID 'IQTY';
PICTURE{||iif(svc_test(cVar]),'99999.99','99999')};
lostfocus {|a,b,oGet|iif(oget:get:changed,sale_keys(xbeK_SH_F3,nChoice,lEdit),nil),;
line_calc( aArray, nChoice, @m_line_tot),;
oBrowse:RefreshAll()}
function svc_test(cVar)
ret_val:=.f.
if at(cVar,'HRS;HR ')>0
ret_val:= .t.
endif
return ret_val
So, if svc_test returns .t., then I should have 99999.99, otherwise I should get 99999. What happens is the entire column will format with the picture setting for whatever item it looked at last; it is not being evaluated line by line. So, if the first line returns .t., all lines will show 99999.99; if then I open up the editor on a line that returns .f., all lines then change to show 99999.
What our customer has is some inventory items that are sold as eaches (1, 2, 10, whatever) and other items that are sold in decimals (1.25, 1.5, etc.) and they want the editing grid to show the correct format so their employees cannot sell items in the wrong units (you can't sell 1.3 computers, but they can sell 1.5 hrs of onsite time). Hope I'm making sense.
DCBROWSECOL ELEMENT 6 HEADER "Qty" PARENT oBrowse;
ID 'FIRST';
EDITOR 'IQTY';
PICTURE{||iif(svc_test(cVar]),'99999.99','99999')};
WIDTH 8
@ nil, nil dcget xNil GETID 'IQTY';
PICTURE{||iif(svc_test(cVar]),'99999.99','99999')};
lostfocus {|a,b,oGet|iif(oget:get:changed,sale_keys(xbeK_SH_F3,nChoice,lEdit),nil),;
line_calc( aArray, nChoice, @m_line_tot),;
oBrowse:RefreshAll()}
function svc_test(cVar)
ret_val:=.f.
if at(cVar,'HRS;HR ')>0
ret_val:= .t.
endif
return ret_val
So, if svc_test returns .t., then I should have 99999.99, otherwise I should get 99999. What happens is the entire column will format with the picture setting for whatever item it looked at last; it is not being evaluated line by line. So, if the first line returns .t., all lines will show 99999.99; if then I open up the editor on a line that returns .f., all lines then change to show 99999.
What our customer has is some inventory items that are sold as eaches (1, 2, 10, whatever) and other items that are sold in decimals (1.25, 1.5, etc.) and they want the editing grid to show the correct format so their employees cannot sell items in the wrong units (you can't sell 1.3 computers, but they can sell 1.5 hrs of onsite time). Hope I'm making sense.
There are only 10 kinds of people - those who understand binary and those who don't 

Re: Picture in dcbrowseol
Hi Bruce,
The PICTURE must be a detached code block if you want it to react to dynamic cell data.
Terry
The PICTURE must be a detached code block if you want it to react to dynamic cell data.
Terry
Re: Picture in dcbrowseol
Can you provide me an example of what you mean by detached code block?
There are only 10 kinds of people - those who understand binary and those who don't 

Re: Picture in dcbrowseol
Hi,
Why don't you use the dcbrowsecolumn data ... clause?
Your data can be a codeblock and returns what you want to show?
Why don't you use the dcbrowsecolumn data ... clause?
Your data can be a codeblock and returns what you want to show?
Re: Picture in dcbrowseol
What is your cVar?BruceN wrote: DCBROWSECOL ELEMENT 6 HEADER "Qty" PARENT oBrowse;
ID 'FIRST';
EDITOR 'IQTY';
PICTURE{||iif(svc_test(cVar]),'99999.99','99999')};
WIDTH 8
Re: Picture in dcbrowseol
cVar is the item type that gets sent to the function to determine if it should be decimal or not.
There are only 10 kinds of people - those who understand binary and those who don't 
