Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
chinnuk00
Contributor
Contributor

Percentage flag

hello guys

i have data as following

t1:

load * Inline[

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,

9 Replies
sunny_talwar

One of these will always be 90%?

Silambarasan1306
Creator III
Creator III

Hi,

Use the below expression,

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

Set the value based on your requirements.

chinnuk00
Contributor
Contributor
Author

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%,-

sunny_talwar

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

chinnuk00
Contributor
Contributor
Author

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

sunny_talwar

May be this:

Table:

LOAD * INLINE [

    rate

    10%

    20%

    40%

    83%

    92%

    93%

    100%

];

Left Join (Table)

LOAD Max(rate) as rate,

  'Low' as Flag1

Resident Table

Where rate < 0.90;

Left Join (Table)

LOAD Min(rate) as rate,

  'High' as Flag2

Resident Table

Where rate >= 0.90;

FinalTable:

LOAD rate,

  Flag1&Flag2

Resident Table;

DROP Table Table;

Capture.PNG

chinnuk00
Contributor
Contributor
Author

Hi bro,

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

sunny_talwar

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

Anonymous
Not applicable

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.