9 Replies Latest reply: Feb 12, 2017 12:59 PM by Bill Markham

# Percentage flag

hello guys

i have data as following

t1:

id,count,rate

1,1,8%

1,2,17%

1,3,25%

2,4,33%

2,5,42%

2,6,50%

3,7,58%

4,8,67%

4,9,75%

4,10,83%

5,11,92%

6,12,100%

] ;

and my requirement is  the VALUE which is close to 90% in rate field should get 'high' and others are low.

for example in the given data for 83% and 92% it should get high remaining should be low

AND THE RESULT SHOULD BE IN FRONT END(PIVOT TABLE)

NOTE:

THE VALUES WHICH IS CLOSER TO 90 MEANS ONLY ONE VALUE BELOW 90 AND ONE VALUE ABOVE 90 SHOULD GET 'HIGH'

EXAMPLE OUTPUT

count,rate,req

1,8%,-

2,17%,-

3,25%,-

4,33%,-

5,42%,-

6,50%,-

7,58%,-

8,67%,-

9,75%,-

10,83%,low

11,92%,high

12,100%,-

ANY HELP IS APPRECIATED,

• ###### Re: Percentage flag

One of these will always be 90%?

• ###### Re: Percentage flag

Hi,

Use the below expression,

If(KeepChar(rate,'0123456789')<=90 and KeepChar(rate,'0123456789')>=80,'HIGH','LOW')

Set the value based on your requirements.

• ###### Re: Percentage flag

my exact requirement is

in rate column the value above 90% which is nearest should get high and the nearest value which is less than 90% should get low

for example

rate,requirement

10%,  -

20%,  -

40%,  -

83%, low

92%,high

93%,-

100%,-

• ###### Re: Percentage flag

And there is no 90% anymore or could there be 90%? If there is 90% does it get High or Low or Null?

• ###### Re: Percentage flag

if there is 90% it should get high others like 91 or 92 it should be ignored or null

• ###### Re: Percentage flag

May be this:

Table:

rate

10%

20%

40%

83%

92%

93%

100%

];

Left Join (Table)

'Low' as Flag1

Resident Table

Where rate < 0.90;

Left Join (Table)

'High' as Flag2

Resident Table

Where rate >= 0.90;

FinalTable:

Flag1&Flag2

Resident Table;

DROP Table Table;

• ###### Re: Percentage flag

Hi bro,

Thanks for the effort but i want it to be done only in UI level not in back end

• ###### Re: Percentage flag

Is rate a field or is it an expression? Can you share an example of how this all looks in your application? I can keep on guessing and we will never get what you want, but if you are able to share something from your end, we might get a solution much easier and faster

• ###### Re: Percentage flag

Try an expression something like this :

if ( below(rate) >=0.9 or below(rate)=null()

, if ( rate <0.9 , 'Low'

, if ( above (rate) <0.9 , 'High'

) ) )

Quite likely you may have to amend it a bit depending on your real data and precise requirements, but it looks ok with your sample data.