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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Selection and Variable formulas

Status
Not open for further replies.

giggles7840

IS-IT--Management
Mar 8, 2002
219
US
CR XI R2
Win XP

I have a formula built off of several other formulas. It identifies records as 1 or 0. Then I want to use this formula in the record selection formula to prevent records from coming in. This has worked on several other formulas I have written/had help writing, but this one just wont go. below is the formula. Let me know if you want to see the other formulas that make up the Total Days formula.

stringvar array Dates := [totext({@Actual - 00 Date}),totext({@Actual - 01 Date}),totext({@Actual - 02 Date}),
totext({@Actual - 2A Date}),totext({@Actual - 03 Date}),totext({@Actual - 3A Date}),totext({@Actual - 04 Date}),
totext({@Actual - 05 Date}),totext({@Actual - 06 Date}),totext({@Actual - 07 Date}),totext({@Actual - 08 Date}),
totext({@Actual - 09 Date}),totext({@Actual - 10 Date}),totext({@Actual - 11 Date}),totext({@Actual - 12 Date})];

stringvar array Desc := ["00 2 Wks Prior to Trench","01 Layout Trench","02 Pour Slab","03 Raise 1st Floor Walls",
"03 Raise 1st Floor Walls","3A Load Trusses","04 Roof Sheathing Inspection","05 Framing Inspection",
"06 Drywall Nail Inspection","07 Install Cabinets","08 Start Flooring","09 Final Inspection","10 Notice of Completion",
"11 Quality Control Walk","12 Buyer Walk Through"];
numbervar cnt := 0;
numbervar i := 0;
numbervar TotalDays := {@Total Days};

i := ubound(Dates);
while i > 1 and Dates = "" do
i := i - 1;

if Desc like ["01*","02*","03*","04*","05*","06*","07*","08*","3A*","2A*"] then
if TotalDays <=20
then
1 else 0;
 
ok i have altered this formula and it still desnt recognize it.

numbervar ActualDays := {@Actual Days};
numbervar ProjectedDays := {@Projected Days};

ActualDays - ProjectedDays;
 
YOu can not use formula based on variables in record selection.

YOu can use the result of a variable to suppress details/groups in the section expert.

However, if you perform summaries then the summary value will include the suppressed values. You will need to use variables to do summaries, evaluating the new variable based upon your original suppressions variable. Hope that makes sense.

Ian
 
Well, actually you CAN use variables in the record selection formula, although it is not a good idea, as it makes for a slow report. For example, (and unrelated to this thread topic), if you wanted to use "like" with a multiple option parameter, you could use a record selection formula like the following, using the Product table from the Xtreme database:

whilereadingrecords;
numbervar i;
numbervar j := ubound({?prod});
stringvar x;

for i := 1 to j do(
if {Product.Product Name} like "*"+{?prod}+"*" then
x := x + {Product.Product Name} + ", ");
{Product.Product Name} in x

Giggles, I think you should be use database fields--the field that has the code starting with "01", etc., and a simple datediff formula. What date fields are you working with? There aren't separate datefields in the database for each code, are there?

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top