Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to show result of the formula in one line

Status
Not open for further replies.

viknass

MIS
Nov 8, 2011
4
CA
I have to show multiple numbervar and stringvar in one row for group total line

I have formula that works fine for stringvar :
_______________________
whileprintingrecords;
stringvar uofm1;

if {SOP30300.ITEMNMBR} <> previous({SOP30300.ITEMNMBR}) then

uofm1 := {IV00108.UOFM}

else
(
if {IV00108.UOFM} <> previous ({IV00108.UOFM} ) then

uofm1 := uofm1 + " " + {IV00108.UOFM}
else
uofm1:= {IV00108.UOFM}
);
_______________
How to get the same formula but for numbervar?

This statement doesn’t work for number variables
uofm1 := uofm1 + " " + {IV00108.Price}

Thanks,
 
Make the numbervar a stringvar and use:

uofm1 := uofm1 + " " + totext({IV00108.Price},2)//2 for two decimals

Of course you wouldn't use the same variable name uofm1 for both variables.

-LB
 
Yes right, I wouldn't. I have "price1" for that.

Thanks.But formula doesn't work with numbervar. I've got a message that "number,currency, date or date time is required here" and " " area is highlighted.

I provide a bit more details of what I need

I have :
item# uofm uofm_price
1 each 0.5
1 box50 25
1 box100 100

I need to show

item# uofm1 uofm_price1 uofm2 uof_price2 oufm3 uofm_price3
1 each 0.5 box50 25 box100 100


Or at least each/ box50/ box100 0.5/ 25/ 100
I was able to show that but prices is not in order.

Any suggestions?

Thanks for you help.

 
I meant for you to use a stringvar instead of a numbervar. Why would you have any ordering issues. You would have separate display formulas for each value.

-LB
 
Stringvar worked ok! Thank you!

But I was asked to show each value separately what I've done.

Now got the other issue :

uofm1 price1 uofm2 price2
each 50 box50 250
box100 100 each 1

Is there a way to show second line from low to high?
Minimum formula won't work.

 
What? Please show the formulas you used that are providing this result. If you accumulate the fields separately (in one formula), you can then reference them in separate display formulas any way you want.

-LB
 
Hi,

this is formulas that I use

//reset in a group header

whileprintingrecords;
stringvar uofm1:="" ;
stringvar uofm2:="";
stringvar uofm3:="";
stringvar uofm4:="";
stringvar uofm5:="";
numbervar price1:=0;
numbervar price2:=0;
numbervar price3:=0;
numbervar price4:=0;
numbervar price5:=0;
numbervar recordcount:=0;

//counts in details

formula 1 for UOFM:

whileprintingrecords;
numbervar recordcount;
stringvar uofm1;
stringvar uofm2;
stringvar uofm3;
stringvar uofm4;
stringvar uofm5;


if recordcount =1 then uofm1 := {IV00108.UOFM}
else
(if recordcount =2 then uofm2 := {IV00108.UOFM}
else
(if recordcount =3 then uofm3 := {IV00108.UOFM}
else
(if recordcount =4 then uofm4 := {IV00108.UOFM}
else
(if recordcount =5 then uofm5 := {IV00108.UOFM}
else
uofm5:=uofm5);
uofm4:=uofm4);
uofm3:=uofm3);
uofm2:=uofm2);
uofm1:=uofm1;
_______________________________
formula 2 for price:

whileprintingrecords;
numbervar recordcount;
numbervar price1;
numbervar price2;
numbervar price3;
numbervar price4;
numbervar price5;


if recordcount =1 then price1 := {IV00108.UOMPRICE}
else
(if recordcount =2 then price2:= {IV00108.UOMPRICE}
else
(if recordcount =3 then price3:= {IV00108.UOMPRICE}
else
(if recordcount =4 then price4:= {IV00108.UOMPRICE}
else
(if recordcount =5 then price5:= {IV00108.UOMPRICE}
else
price5:= price5);
price4:= price4);
price3:= price3);
price2:= price2);
price1:= price1;

// group footer formulas

whileprintingrecords;
stringvar uofm1;

uofm1 ;
________

whileprintingrecords;
numbervar price1;

price1 ;

etc. Separate displays for all variables.
_______________

The result:

EACH 4.10 PACK6 24.60
CASE12 202.20 EACH 16.85
CASE12 25.80 EACH 2.15
CASE400 76.00 EACH 0.19
BOX12 18.12 CASE120 181.20 EACH 1.51
CASE96 16.32 EACH 0.17 PACK12 2.04
BOX5 41.25 CASE50 412.50 EACH 8.25

I need all rows starts with lowest value.


Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top