Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
 sibideepak
		
			sibideepak
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi all ,
I want to generate some random values between 20 to 50 for each ID in my table.
Example:
S.No CustID Value
1 101 22
2 102 36
3 101 22
4 105 29
5 108 45
6 102 36
If is it possible .. how to do it ?
Thanks in advance 
 
					
				
		
 jagan
		
			jagan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Or
Try like this
Data:
LOAD *
INLINE [
S.No, CustID
1, 101
2, 102
3, 101
4, 105
5, 108
6, 102
];
Temp:
LOAD Distinct
CustID
RESIDENT Data;
LEFT JOIN(Data)
LOAD
*,
Floor(Rand() * 30 + 20) AS Value
RESIDENT Temp;
DROP TABLE Temp;
Regards,
Jagan.
 
					
				
		
 Ralf-Narfeldt
		
			Ralf-Narfeldt
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		LOAD *,
Floor(Rand()*30) + 20 As Value;
LOAD * INLINE [
S.No, CustID
1, 101
2, 102
3, 101
4, 105
5, 108
6, 102
];
 
					
				
		
 sibideepak
		
			sibideepak
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks Ralf,
But again have a look at description and example where each CustID have same value all time ..dont change every time ..i.e) for 101 value should always be 22 and for 102 it is 36.
 
					
				
		
 jagan
		
			jagan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
Try like this
Data:
LOAD *, AutoNumber(CustID) + 20 As Value
INLINE [
S.No, CustID
1, 101
2, 102
3, 101
4, 105
5, 108
6, 102
];
Hope this helps you.
Regards,
Jagan.
 
					
				
		
 jagan
		
			jagan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Or
Try like this
Data:
LOAD *
INLINE [
S.No, CustID
1, 101
2, 102
3, 101
4, 105
5, 108
6, 102
];
Temp:
LOAD Distinct
CustID
RESIDENT Data;
LEFT JOIN(Data)
LOAD
*,
Floor(Rand() * 30 + 20) AS Value
RESIDENT Temp;
DROP TABLE Temp;
Regards,
Jagan.
 
					
				
		
 Ralf-Narfeldt
		
			Ralf-Narfeldt
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Sorry, missed that point with the CustID. Then you need to load a distinct CustID table and join like Jagan's second example.
 
					
				
		
 sibideepak
		
			sibideepak
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks for your answer !! Hope it'll work for my scenario 
