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

If And Statement

Status
Not open for further replies.

kwirky

MIS
Apr 22, 2010
85
AU
Hi,
I need to show any jobs which are on hold but I want them removed when their status changes to in progress, so am guessing it would be a if-and-statement?
I have journal entries which show job number, date and time of the journal entries and a series of descriptions. The descriptions I am interested in are the ones that say ON HOLD. I want these jobs to show if they have not been put back into production.

{journals.jobnumber} {Journals.datetime} {journals.description}
123456 09/09/2011 9.09am ON HOLD
123456 09/09/2011 9.30am IN PROGRESS
234512 09/09/2011 9.32am ON HOLD
457593 09/09/2011 9.45am ON HOLD


So based on the example, I have 3 jobs which have been placed on hold, however of those, job 123456 has been placed back into production, so does not need to appear on the report.

I thought I could have something like

@Restarted
if {@On Hold} = "On Hold" and
if {Journals.Description} like "*In Progress"
then "restart"

However I think my syntax is out as I get an error "The keyword 'then' is missing"

What is the proper syntax etc to use for an if-and-then statement?

(Am using CR2008 & SQL database)

Thanks
Joanne
 
Hi,
not sure about your formula being the one to give what you need but its syntax is almost correct, just remove the second IF:
Code:
@Restarted
if {@On Hold} = "On Hold"
 and 
{Journals.Description} like "*In Progress"
then
 "restart"



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
I went another way with this which kind of sorted my problem.
I grouped by job number and then used the maximum of the journal entries (based on date) to give me the most recent description.

Because there are many types of journal entries, I used a formula

if ({Journals.Description}) = "Changed to: ON HOLD" then "on hold"

which then shows that there are entries that I want.

Now I just want to have these only.

How can I do a "if the maximum{Journals.Description}) = "Changed to: ON HOLD", then only show these records"
 
Go to report->selection formula->GROUP and enter:

{journals.datetime} = maximum({journals.datetime},{journals.jobnumber}) and
{Journals.Description} = "Changed to: ON HOLD"

This will return the most recent record per jobnumber IF it is on hold.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top