Smart questions
Smart people
 Find A ForumFind An Expert
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Remember Me

Are you a
Computer / IT professional?
Join Tek-Tips now!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Just copy and paste the

#### Feedback

"...Over the past year I have found your site to be EXCELLENT. Never have I been able to find so many answers to such vast problems and it is an excellent service..."

#### Geography

Where in the world do Tek-Tips members come from?

# Crystal - Variable declaration

 Forum Search FAQs Links Jobs Whitepapers MVPs
 kavithapedada (Programmer) 7 May 12 4:32
 Shared NumberVar  m1 ;Shared NumberVar m2;Shared NumberVar m3;Shared NumberVar m4;Shared NumberVar m5;Shared NumberVar m6;Shared NumberVar m7;Shared NumberVar m8;Shared NumberVar m9;Shared NumberVar m10;Shared NumberVar m11;Shared NumberVar m12;if {@mONTH} = 1 thenm1= {@mONTH} ;if {@mONTH} = 2  thenm2 = {@mONTH}; if {@mONTH} = 3 thenm3 = {@mONTH} ;if {@mONTH} = 4 thenm4= {@mONTH} -1;if {@mONTH} = 5 thenm5 = {@mONTH} -2;if {@mONTH} = 6 thenm6 = {@mONTH} -3;if {@mONTH} = 7 thenm7= {@mONTH} - m6 - m3;if {@mONTH} = 8 thenm8 = {@mONTH} - m6 - m3;if {@mONTH} = 9 thenm9 = {@mONTH} - m6- m3;if {@mONTH} = 10 thenm10= {@mONTH} - m9 - m6 -m3;if {@mONTH} = 11 thenm11 = {@mONTH}- m9 - m6 - m3;if {@mONTH} = 12 thenm12 = {@mONTH} - m9 - m6 - m3;   if  {@mONTH} = m1 +  m2 + m3 and {@Year} = {?YEAR}   then  "This year Q1 "   if  {@mONTH} = m1 +  m2 + m3 and {@Year} = {?YEAR} -1   then  "Last year Q1 "   Variance = Q1 This Year - Last year  then  "This year Q1 "  if  {@mONTH} = m4 +  m5 + m6 and {@Year} = {?YEAR}  then  "This year Q2 "etc.............................Here {@MONTH} = Formula to get the month from Date     i want to display in the Cross Tab like " Q1 - This Year" and Q1 - Last Year" and Variance etc...Iam unable to to use the above logic some where id i did mistake please help me to clear it
 lbass (TechnicalUser) 7 May 12 6:42
 You need to use := instead of : to set the variables, like this:if {@mONTH} = 1 thenm1 := {@mONTH};-LB
 kavithapedada (Programmer) 8 May 12 0:10
 if {@mONTH} = 1 thenm1 := {@mONTH};if i use this syntax its giving the below error""A PRINT TIME FORMULA THAT MODIFIES VARIABLES IS USED IN A CHART OR MAP""
 lbass (TechnicalUser) 8 May 12 6:44
 You didn't mention that you were trying to chart with these formulas. The error message is because you are using variables. If you must chart these, then you have to use a complex technique "Charting on Print-time Formulas" as shown here: http://www.sdn.sap.com/irj/boc/go/portal/prtroot/docs/library/uuid/40e7130d-aa1e-2b10-ce9f-eee2a54ff4cd?QuickLink=index&;overridelayout=trueWhy are you using shared variables in the first place? What is the purpose of the adjustments you are making to values?-LB
 kavithapedada (Programmer) 8 May 12 23:04
 Hi I want to calu the Last year and this year Q1 values with conditions likein Paramters if they enter: Period = 10 then the Its Q4 , so the values need to come like 10 - 9 -6-3( Need to subtract the previous Quartes values) for the present Qurater valueRegards,Kavitha.
 lbass (TechnicalUser) 9 May 12 6:38
 Please show the content of {@Month}. In looking at your formula, it doesn't make sense. You are just saying if a month = 1 then you are setting it equal to 1, etc.Also, you seem to want to subtract other values, so is your value field cumulative? Please show some sample data and label it.You did not explain why you are using shared variables.-LB

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!