9 Replies Latest reply: Sep 19, 2013 2:11 AM by Paul Yeo

How to make Discount=0 change to Discount=1 ?

Hi All

I have a Field Discount in my Table

When i select BRNAD_P = HAKKO or MITSUBISHI Discount = 0

May i know how to make it = 1 ? ( Because List Price * Discount = Net Price , If Discount = 0 , Net price will be zero )

left join    (PRICE)

'USD '& LIST_PRICE as PRICE_LIST,

1-Discount as Discount_

Resident PRICE;

My Question is how to add some more script to below code , so that when it see 0 it will replace with 1 :-

1-Discount as Discount_

• Re: How to make Discount=0 change to Discount=1 ?

Hi All

Enclosed my QV doc.

Paul

• Re: How to make Discount=0 change to Discount=1 ?

For get to mentioned for testing you need to create a folder at C:\GE

• Re: How to make Discount=0 change to Discount=1 ?

Hi Paul,

If(Discount_ = 0,1,Discount_) as Discount

and then use this field Discount in place of Discount_

Hope this helps!

• Re: Re: How to make Discount=0 change to Discount=1 ?

Hi Shy

I try :-

If(Discount = 0,1,Discount) as Discount_

I still get 0.

Any idea ?

Paul

• Re: How to make Discount=0 change to Discount=1 ?

Hi Paul,

At the front-end you can use this formula for discount:

If(SUM(Discount)=0,1,Sum(Discount))

• Re: Re: How to make Discount=0 change to Discount=1 ?

Hi Tres

when i try your script :-

If(SUM(Discount)=0,1,Sum(Discount)) as Discount2,

I get error msg. expression error. may be i misunderstand your suggestion.

Paul

• Re: How to make Discount=0 change to Discount=1 ?

Hi Tres

Now i understand what you mean , it work when i use your script at expression.

But for my application , i intend to make use of load script to cal the net price. any idea how to make load script work ?

Paul

• Re: How to make Discount=0 change to Discount=1 ?

Well, if you want back-end solution try:

If(Isnull(Discount) or Len(Trim(Discount))=0 or Discount=0, 1, Discount) as _Discount

• Re: How to make Discount=0 change to Discount=1 ?

Hi Tres

Thank you vey much it work fine now.

Paul