Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
Hi All,
I have a field that contains numbers, lets say from 1 to 10(and not necessary that it contains only 10 entries, it can have hundreds of distinct entries) and a variable having numeric value(not static).
Now i want to use a loop such that if variable's value matches with any of the value in the field, it performs first expression (say display TRUE) else second expression(say displays FALSE)
let me know the loop condition and syntax.
Thanks
 
					
				
		
 sushil353
		
			sushil353
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
In case you have that field containing numbers as Dimension of chart then you can simply use match function for desire expression to calculate..
in expression you can write: if(Match(field,$(Variable))>0,exp1,exp2)
HTH
sushil
 
					
				
		
 sushil353
		
			sushil353
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
In case you have that field containing numbers as Dimension of chart then you can simply use match function for desire expression to calculate..
in expression you can write: if(Match(field,$(Variable))>0,exp1,exp2)
HTH
sushil
 
					
				
		
 sujeetsingh
		
			sujeetsingh
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Where you want this loop in some script.
Let vTab=3;
Table:
LOAD * INLINE [
ID, Values
1, 25
2, 23
3, 34
4, 21
5, 12
];
Data:
load
ID, Values
,if(ID=$(vTab),'True','False') as Flag
Resident Table;
DROP Table Table;
 tresesco
		
			tresesco
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Try like:
Load
If(FieldValue=$(vVriable), 'True', 'False') as Flag
 
					
				
		
Hi Deepak
if you are really looking for the loop option below is the code if not use the above one which is suggested by @sujeetsingh
Test:
LOAD * INLINE [
Field
1
2
3
4
5
6
7
8
9
10
];
set variable=9;
for i = 1 to NoOfRows('Test')
let find=FieldValue('Field',$(i));
if($(i)=1)then
Test1:
NoConcatenate
load Distinct $(find) as Field,if($(find)=$(variable),'True','False') as [True/False] Resident Test;
else
Concatenate(Test1)
Load Distinct $(find) as Field,if($(find)=$(variable),'True','False') as [True/False] Resident Test;
end if
next
drop table Test;
Regards
Harsha
