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

if condition in scripting

If there is a field name  (period_num) having months  1 to 13 & there is another field(ftm). According to the requirement I want to consider till (period_num)=12, such that ftm of period_num=13 is added in ftm of period_num =12

5 Replies
OmarBenSalem

Maybe sthing like this :

//Suppose this is your current table

ftm:

load * inline [

num,ftm

1,10

2,20

3,30

4,40

5,50

6,60

7,70

8,80

9,90

10,100

11,110

12,120

13,130

];

//what you should do

newFtm:

NoConcatenate

load num,sum(ftm) as FTM group by num ;

load num, ftm Resident ftm where num<>12 and num<>13;

Concatenate

load num, sum(ftm) as FTM group by num;

load '12' as num, (ftm) Resident ftm where num=12 or num=13;

drop table ftm;

result:

Capture.PNG

prabhu_rutali
Contributor
Contributor
Author

Ty omar.

OmarBenSalem

That did the trick?

prabhu_rutali
Contributor
Contributor
Author

yes

OmarBenSalem

Good.

Then please, don't forget to close the thred by marking the correct answer as correct.