Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula for variable with conditions 1

Status
Not open for further replies.

mwhager

IS-IT--Management
Jun 8, 2000
27
US
If someone could help me with this formula I would really appreciate it. I need to define a variable Y that sums the values from general ledger periods only for a certain group of GL accounts. The value of Y changes depending on the GL period. So what I want is:
if {?Period} = 12 then Y:= {GLCGLMS.GL_ACCT_PRY_VAL_1}+{GLCGLMS.GL_ACCT_PRY_VAL_2}
+{GLCGLMS.GL_ACCT_PRY_VAL_3}+{GLCGLMS.GL_ACCT_PRY_VAL_4}+{GLCGLMS.GL_ACCT_PRY_VAL_5}+{GLCGLMS.GL_ACCT_PRY_VAL_6}
+{GLCGLMS.GL_ACCT_PRY_VAL_7}+{GLCGLMS.GL_ACCT_PRY_VAL_8}+{GLCGLMS.GL_ACCT_PRY_VAL_9}+{GLCGLMS.GL_ACCT_PRY_VAL_10}
+{GLCGLMS.GL_ACCT_PRY_VAL_11}+{GLCGLMS.GL_ACCT_PRY_VAL_12}

BUT I NEED TO ADD that I only need these values when the {GL-ACCT}[7 to 10]='4000' to '9999'. I cannot do
if {?Period} = 12 and {GL-ACCT}[7 to 10]='4000' to '9999' then Y:= ..... because I need this value later in another circumstance and the formula will return 0 in the other circumstance.

Any help would be appreciated.
 
that isn't a problem

@calc

WhilePrintingRecords;
numberVar Yvalue := 0;
numberVar Xvalue := 0;

if {?Period} = 12 then
Yvalue:= {GLCGLMS.GL_ACCT_PRY_VAL_1} +
{GLCGLMS.GL_ACCT_PRY_VAL_2} +
{GLCGLMS.GL_ACCT_PRY_VAL_3} +
{GLCGLMS.GL_ACCT_PRY_VAL_4} +
{GLCGLMS.GL_ACCT_PRY_VAL_5} +
{GLCGLMS.GL_ACCT_PRY_VAL_6} +
{GLCGLMS.GL_ACCT_PRY_VAL_7} +
{GLCGLMS.GL_ACCT_PRY_VAL_8} +
{GLCGLMS.GL_ACCT_PRY_VAL_9} +
{GLCGLMS.GL_ACCT_PRY_VAL_10} +
{GLCGLMS.GL_ACCT_PRY_VAL_11} +
{GLCGLMS.GL_ACCT_PRY_VAL_12};

If {GL-ACCT}[7 to 10] in '4000' to '9999' then
Xvalue := Yvalue
else
Xvalue := 0;

There now you have both values preserved for further use. If you want to display a result of Xvalue with this formula just place this at the end

Xvalue;

hope this helps


Jim Broadbent
 
Thanks for the help. It got me pointed back in the right directions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top