Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 qlikmark1990
		
			qlikmark1990
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Currently I have this loop that has the output:
1
2
3
4
5
6
FOR vraagNummer = 1 TO 6
TRACE $(vraagNummer);
NEXT
How can I add leading zeroes to the variable to get the output :
001
002
003
004
005
006
In other topics I only read about leading leading zeros to fields instead of variables. If the loop goes further than 10 I'd like to get :
010
011 ect. untill 999
....
999
 
					
				
		
 benoitgochel
		
			benoitgochel
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Mark,
Try something like this :
if(vraagNummer > 99) then
SET output = $(vraagNummer );
elseif (vraagNummer > 9) then
SET output = 0$(vraagNummer );
else
SET output = 00$(vraagNummer );
endif;
Hope that helps. 
Best regards
 
					
				
		
 benoitgochel
		
			benoitgochel
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Mark,
Try something like this :
if(vraagNummer > 99) then
SET output = $(vraagNummer );
elseif (vraagNummer > 9) then
SET output = 0$(vraagNummer );
else
SET output = 00$(vraagNummer );
endif;
Hope that helps. 
Best regards
 
					
				
		
Hello,
Try this:
FOR vraagNummer = 1 TO 6
Let Number = Num($(vraagNummer), '000');
TRACE $(Number);
NEXT
