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

Current date formula. 1

Status
Not open for further replies.

mudflap

MIS
Feb 14, 2002
194
CA
I have a field I am trying to do this with.

if (prepress wip(b.duedate) = current date then



What I want it to do is print out the one that equal the current date..What goes after then .
The formula works but just need the last part to tell me
what jobs are due or atleast the total that are due today.

Thanks

Peter
 
previous({Prepress WIP.Docket}) <> {Prepress WIP.Docket} means:

check that the current docket is not the same as the docket on the last line.

It's interesting that you're still getting zeroes. Comment the previous line out so it looks like the formula below and see what happens to your formula.

whileprintingrecords;
numbervar job;
If {Prepress WIP.Proofs Due} = currentdate //and
//previous({Prepress WIP.Docket}) <> {Prepress WIP.Docket}
then job := job + 1
else job;

If you're still having problems, let me know and I'll let you have an email address if you want me to have a look at your report.

Naith
 
Yes, still having problems that gives me 0.00 after refreshing the report.
Something still isn't right.

Thanks

Peter
 
Okie dokie. As long as you don't mind me having a look at your data, send your report to samia.mallem@wesleyannsales.co.uk, and I'll have a look at that sucker.

Remember to run the report, go to the last page, and save the report with data in it.

Naith
 
That email address gives me a return error?

Maybe email me and I will reply.

Peterh@trico.on.ca
 
That worked unbelievable...Thanks alot for all your help Naith..
I changed the forumla to show the job number instead.
Looks great.

One last thing..It prints out a 36. then the job number.
Do you know why?
I.E

36. The commmison Due Today.

Thanks Alot
Peter
 
Yeah, I was checking that out after I sent you the formulae, and wondered if it would actually be any use to you.

If you check out the formula you're using now:

whileprintingrecords;
numbervar counter := counter+1;
stringvar job;
If {Prepress WIP.Proofs Due (Date) (User Defined)} = currentdate then
job := job + totext(counter,0)+ &quot;. &quot; + {Prepress WIP.Description (User Defined)} + chr(13)
else job

you'll see the job variable in the 6th line combines the counter with the job name. The counter is nothing more than the number the job appears in the report. So, if it was the first job and the tenth job due today:

Jobs Due Today
1. Take a long lunch
10. Leave early

Being as you aren't displaying the counter, you'd do just as well to take the functionality out.

Just change the job assignment to:

job := job + {Prepress WIP.Description (User Defined)} + chr(13)

Looking at your data, it probably even makes more sense to assign the docket to the job variable rather than the job description, being as the job description isn't unique.

See you later Pete,

Naith
 
Naith that worked great thank you.

I have another formula that should be the exact same except with different fields. I tried it but. For some reason it gives me the same answer as the other one and it shouldn't.
How do I differenciate between the two formula's...
This is what I have.
I put in job2...is that right.
Then I call it with the stringvar stuff.

whileprintingrecords;
numbervar counter := counter+1;
stringvar job2;
If {Prepress WIP.Proofs Out (Date) (User Defined)} = currentdate then
job2 := job2 + {Prepress WIP.Docket (User Defined)} + &quot; &quot; + {Prepress WIP.Client (User Defined)} +chr(13)
else job2
&quot;)
 
What's with that &quot;) action at the end of your formula?

If that's just a typo, and your formula looks like

whileprintingrecords;
numbervar counter := counter+1;
stringvar job2;
If {Prepress WIP.Proofs Out (Date) (User Defined)} = currentdate then
job2 := job2 + {Prepress WIP.Docket (User Defined)} + &quot; &quot; + {Prepress WIP.Client (User Defined)} +chr(13)
else job2

Then that's perfect. As long as this formula is in the details section, and in the report footer, you have another formula like:

whileprintingrecords;
stringvar job2;

That will bring back the results you want. It sounds as if your report footer formula is still calling the variable job instead of job2.

Naith
 
I just noticed something...The first formula is only printing one record..Should be 5 records it total.
Any idea why?

THanks
 
You don't have the formula in the details section.
 
Send the report to the address you sent it to last time.

Let's see if we can't set you straight before the weekend's afoot.

Naith
 
Getting an error when I use the formula that prints out the past due stuff..Say string can only be 256 characters.
Does this mean that because there are alot of records it doesn't want it to be over 256?

Thanks
Peter
 
Yep. When I had a look at your formulas, the reason for the initial issue was that the Can Grow option was off.

I thought you might end up trying to capture 'Overdue' jobs by simply looking at jobs where the date was less than the current date.

This will definitely break Crystal's string limit of 254 characters. In any case, you'd need to combine the date criteria with a Complete/Incomplete flag to determine it's overdue status.

You can get around the 254 error by:

(a) reverting back to a count (as opposed to a list) of records
(b) remove the job desc and just have the docket no in the list
(c) run a string length check on your variable and catch it if it looks like it's about to make the report fall over.

To do this last one,

whileprintingrecords;
numbervar counter := counter+1;
stringvar job;
stringvar job_backup;

If {Prepress WIP.Proofs Due (Date) (User Defined)} = CurrentDate then
If Length(job)+ Length({Prepress WIP.Docket (User Defined)}) + Length({Prepress WIP.Client (User Defined)})+2 > 254 Then
If Length(job) + 17 > 254 Then job := &quot;Job List Too Long&quot;
Else job := job + &quot;Job List Too Long&quot;
Else
job := job +
//--Suggestion (b) is to take the next line out:
{Prepress WIP.Docket (User Defined)} + &quot; &quot; +
//--end
{Prepress WIP.Client (User Defined)} + chr(13)
Else job

Whatever you decide, you should do it to job1, 2, and 3, even if the rest of them aren't playing up yet.

Naith
 
Man..Now I am totally confused..I really need a course in this stuff..OR atleast a book.

Where does the above formula go??
Sorry all messed up.
 
Comment out the text in your red {@Due Today} formula in the details section.

Then paste the formula I wrote above.

As long as the formula is worked out in the details section, you don't need to change any of the formulae in the footer sections.

Naith
 
Tried that and it(I) messed up the form.
Gives me Job list to long on a list that isn't too long?
Ugg..
Really wish I knew what I was doing..
Really confused now. Always hated programming.
Not sure where to start.

Can't seem to get it do anything for me.
 
Sounds like you have Friday Lethargy setting in.

You're only going to get that 'Job List Too Long' return when you really do have over 254 characters in your string.

But the 3rd suggestion isn't your only option. I would remove the job description from the variable, and just return the docket information. That way, your strings will be well under the 254 character limit.

//--Suggestion (b) is to take the next line out:
{Prepress WIP.Docket (User Defined)} + &quot; &quot; +
//--end

Follow that course of action, (leaving the 'Job List Too Long' error handler in) and you'll receive a full list.

Naith
 
So if that Job list is too long error comes up.
That means I will get the full list?

I tried using only the docket number but there are 7 characters per record and 50 records..Over the limit.
 
This sounds to me like you're still basing your overdue jobs simply on Date < CurrentDate. This criteria is too generic and will return too many records.

If your list is too long, you will have to use the first suggestion: Switch back to a numerical list.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top