Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I was trying to do a simple series of set variable statements based on the value of another variable, like this:
IF $(vCurrentYear) = "2013-14" THEN
SET vPrevYear = "2012-13";
IF $(vCurrentYear) = "2014-15" THEN
SET vPrevYear = "2013-14";
But these cause the script to load nothing at all, and an hour of Googling hasn't gotten me anywhere. This seems like it should be a very simple thing. Is there a better way to do this? Thanks in advance!
Hi Shawn,
Try like this
SET vCurrentYear = '2013-14';
IF vCurrentYear = '2013-14' THEN
SET vPrevYear = '2012-13';
ELSEIF vCurrentYear = '2014-15' THEN
SET vPrevYear = '2013-14';
END IF;
Regards,
Jagan.
make it
if '$(vCurrentYear)'='2013-14' then
set......
if '$(vCurrentYear)'='2014-15'
Your variable stores a string so the Dollar sign expansion needs to be enclosed within single quotes.
Hi Shawn,
Try like this
SET vCurrentYear = '2013-14';
IF vCurrentYear = '2013-14' THEN
SET vPrevYear = '2012-13';
ELSEIF vCurrentYear = '2014-15' THEN
SET vPrevYear = '2013-14';
END IF;
Regards,
Jagan.
Hi, try this
set vCurrentYear ='2013-14';
IF '$(vCurrentYear)' = '2013-14' THEN
SET vPrevYear = '2012-13';
IF $(vCurrentYear) = '2014-15' THEN
SET vPrevYear = '2013-14';
END if
end if
good luck!
Fernando
Worked perfectly.
Thanks so much, Jagan!