Picture in dcbrowseol

This forum is for eXpress++ general support.
Message
Author
BruceN
Posts: 280
Joined: Thu Jan 28, 2010 7:46 am
Location: Slidell, LA

Picture in dcbrowseol

#1 Post by BruceN »

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 :)

User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Picture in dcbrowseol

#2 Post by rdonnay »

Use the PICTURE '999999.99' clause on the numeric column.
The eXpress train is coming - and it has more cars.

BruceN
Posts: 280
Joined: Thu Jan 28, 2010 7:46 am
Location: Slidell, LA

Re: Picture in dcbrowseol

#3 Post by BruceN »

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 :)

bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: Picture in dcbrowseol

#4 Post by bwolfsohn »

bruce,

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

BruceN
Posts: 280
Joined: Thu Jan 28, 2010 7:46 am
Location: Slidell, LA

Re: Picture in dcbrowseol

#5 Post by BruceN »

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.
There are only 10 kinds of people - those who understand binary and those who don't :)

User avatar
TWolfe
Posts: 60
Joined: Thu Jan 28, 2010 7:34 am

Re: Picture in dcbrowseol

#6 Post by TWolfe »

Hi Bruce,

The PICTURE must be a detached code block if you want it to react to dynamic cell data.

Terry

BruceN
Posts: 280
Joined: Thu Jan 28, 2010 7:46 am
Location: Slidell, LA

Re: Picture in dcbrowseol

#7 Post by BruceN »

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 :)

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Picture in dcbrowseol

#8 Post by skiman »

Hi,

Why don't you use the dcbrowsecolumn data ... clause?

Your data can be a codeblock and returns what you want to show?
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Picture in dcbrowseol

#9 Post by skiman »

BruceN wrote: DCBROWSECOL ELEMENT 6 HEADER "Qty" PARENT oBrowse;
ID 'FIRST';
EDITOR 'IQTY';
PICTURE{||iif(svc_test(cVar]),'99999.99','99999')};
WIDTH 8
What is your cVar?
Best regards,

Chris.
www.aboservice.be

BruceN
Posts: 280
Joined: Thu Jan 28, 2010 7:46 am
Location: Slidell, LA

Re: Picture in dcbrowseol

#10 Post by BruceN »

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 :)

Post Reply