Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
Hi All,
It's NYE, so this is probably a result of the end of the working year, but this is confusing the life out of me.
I have two variables I'm declaring at the beginning of my script:
let vCurrentYear = year(today());
let vCurrentMonth = month(today());
The first correctly returns 2013.
The second appears to return a null value (to check I put both into separate text objects on my sheet. The vCurrentMonth displays as '-', the vCurrentYear as '2013').
Any ideas?
Thanks!
Rory.
 
					
				
		
Rory Webber wrote:
Isn't Month() supposed to return an int?
Month() returns a dual data type, i.e. text and a number. You need to use Num(Month(today())) to return an int.
 Peter_Cammaert
		
			Peter_Cammaert
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Works for me though. Are you sure you made no spelling mistakes in your text box?
To be sure, open Settings->Variables in your QV Desktop and check the value of vCurrentMonth.
Peter
 
					
				
		
 sivarajs
		
			sivarajs
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		try by using
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec'; in script
 
					
				
		
OK - more confusion now!
In the Variable Overview it shows that vCurrentMonth has a value of 'Dec'. Isn't Month() supposed to return an int? On the text box I used the variable lookup dropdown to insert the variable name, so shouldn't be a spelling issue '=$(vCurrentMonth)' is the value in the text box expression.
 Peter_Cammaert
		
			Peter_Cammaert
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Aha! I see...
Put the following in your text box expression window:
='$(vCurrentMonth)'
That should work.
Best wishes,
Peter
 
					
				
		
Rory Webber wrote:
Isn't Month() supposed to return an int?
Month() returns a dual data type, i.e. text and a number. You need to use Num(Month(today())) to return an int.
 
					
				
		
 jonathandienst
		
			jonathandienst
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi
Month() returns a dual, which displays as 'Dec' but has an underlying value of 12. Don't use $() explansion as it will attempt to calculate the expression 'Dec' which will return null. Just use =vCurrentMonth.
The $() expansion works for the year, because that is straight numeric, but it is unnecessary, so also use =vCurrentYear
HTH
Jonathan
 
					
				
		
=num(Month(Today()); then you have your int.
 
					
				
		
 suniljain
		
			suniljain
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Please try
=Text(Month(today()))
 
					
				
		
Hi ,
can u pls try this
=month(Now())
