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!

Conditional Record Selection?

Status
Not open for further replies.

ztruelove

Technical User
Oct 3, 2008
13
US
I'm attempting to pull some information from my company's Helpdesk ticket system, but my attempt at a conditional record selection isn't returning the correct information.

In its simplest form, I'm trying to pull ticket #s grouped by category with a condition on one of those categories.

So I'd like to see all tickets of Category_A, Category_B, and Category_C, and I'd like to see tickets from Category_D if either Condition_1 OR Condition_2.

I attempted an If-Then clause in the Record Selection formula, but it didn't give correct results. I also tried a Group Selection formula (which I've never used before), and didn't make any headway there either.

I'm sure there's an easy answer to this, but I'm just ignorant as to how to proceed.
 
Try this

(
(
{ticket.category} in ["Category_A","Category_B","Category_C"]
) or
(
{ticket.category} = "Category_D" and {ticket.condition} in ["Condition_1","Condition_2"]
)
)


-lw
 
Place in record selection

(
{ticket.category} in ["Category_A","Category_B","Category_C"] or
(
{ticket.category} = "Category_D" and {ticket.condition} in ["Condition_1","Condition_2"]
)
)
 
I had tried something similar to that, but here's the resulting problem.

If I set the Record Selection formula to

======================================================
{CallLog.RecvdDate} startswith {?Year} and
{CallLog.Category} in ["Administration", "Change Control", "INCIDENT", "Rig", "Work Order"]
======================================================

and compare the results against the Record Selection formula

======================================================
{CallLog.RecvdDate} startswith {?Year} and
(
{CallLog.Category} in ["Administration", "Change Control", "INCIDENT", "Rig"] or
({CallLog.Category} = "Work Order" and {Detail.SR_Tech} = "Y") or
({CallLog.Category} = "Work Order" and {Detail.SR_Apps} = "Y")
)
======================================================

The only change I expect to see would be in the number of results for the "Work Order" category. Instead, I'm getting changes in #s for multiple categories. Am I missing something obvious?
 
Sounds like one or both of the fields in the Detail table can be null, so when you add the fields to the selection, you are limiting the records in other categories. So remove the reference to the detail table in the selection formula and instead use a left join from the calllog table to the detail table, and then suppress report sections using a formula like this:

{CallLog.Category} = "Work Order" and
not (
{Detail.SR_Apps} = "Y" or
{Detail.SR_Tech} = "Y"
)

-LB
 
You're the best! I had actually used that same Record Selection formula before, but my join was wrong. Once I changed the join, it worked like a champ.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top