Premahari
21st January 2019, 12:57
Hi i have one session where i've Maintained values like, if my value
upto 10000 - 1,
upto 50000 - 3 ,
upto 99999999(greater than 50000) - 5

For example:
I have an value of 118795. It's greater than 50000 so it has to take value of 5. But its taking 3. Below is logic i have used

select tiesc071.*
from tiesc071
where tiesc071._index1 = {:efdt,:tiesc062.crit}
and tiesc071.risk >= :tiesc062.cval
order by tiesc071.risk
as set with 1 rows
selectdo
invl = tiesc071.rval
endselect

For other values it's working only amount's greater than 100000 not working

okneb1
21st January 2019, 13:45
Which domains are you using on fields tiesc071.risk and tiesc062.cval?

Premahari
21st January 2019, 13:47
For both I have used domain tcmcs.str50.

mark_h
21st January 2019, 14:37
Is there any reason you can't use a value on the table? Because I believe in a string the 5 is greater than the 1 in 118795. Someone correct me if I am wrong.

okneb1
21st January 2019, 14:40
mark_h, you are correct.
In world of strings "50000" is greater than "118795". I would recommend using long domains.

tmannais
22nd January 2019, 06:54
Try

long risk
long cval
cval= val(tiesc062.cval)
select tiesc071.rval, CAST(tiesc071.risk AS INTEGER) :risk
from tiesc071
where tiesc071._index1 = {:tiesc062.crit}
and risk >= :cval
order by risk
as set with 1 rows
selectdo
invl = tiesc071.rval
endselect

Premahari
22nd January 2019, 07:50
Thank you all. Domain problem only. Now its working