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!

Selection Export in CR9

Status
Not open for further replies.

trafficstudent

Programmer
Oct 21, 2005
106
US
I have the formula below in my record selection window: Waht is going on is when i select a Part Number I return the part number and all dates up to the creation of the database. If I select a Part Number and a Date Range (as coded after the "or") I still return the Part Number and all the dates.

I don't know why im returning all dates when i specifically declare the piece of code with a date range parameter?

Can anyone help m out?


({LaborDistribution.PartNumber} = {?Part Number Selection} and
not ({WorkCenters.WorkCenterID} startswith "9") and
{LaborDistribution.StartDate} <> {LaborDistribution.StopDate})

or

({WOHeader.StartDate}={?Date Range} and
{LaborDistribution.PartNumber} = {?Part Number Selection} and
not ({WorkCenters.WorkCenterID} startswith "9") and
{LaborDistribution.StartDate} <> {LaborDistribution.StopDate})
 
Records that meet the criteria in the first section before the "or" are included in the report--once they meet the criterion, the second part of the "or" is not evaluated. So if you want both date range and part number to apply, just use:

(
{WOHeader.StartDate}={?Date Range} and
{LaborDistribution.PartNumber} = {?Part Number Selection} and
not ({WorkCenters.WorkCenterID} startswith "9") and
{LaborDistribution.StartDate} <> {LaborDistribution.StopDate}
)

What was your rationale for including the first part?

-LB
 
The what i want to happen is on the first part of the equation (before the or) I want the part number to return with all dates. On the second part (after the or) I want the part number to return but this time i need only the part number that are valid in the date range field. (therefore im trying to sort my data based on date and partnubmer)
 
That really makes no sense. Do you mean that you want some part numbers to be returned regardless of dates and other part numbers to fall within the date range? If so, what distinguishes those two sets of part numbers? Or do you have a typo in your original post? Both sides of the "or" statement are exactly the same EXCEPT that one side has a date range.

-LB
 
lbass, you are correct (Do you mean that you want some part numbers to be returned regardless of dates and other part numbers to fall within the date range?) I want exacty that. However to answer your 2nd question (If so, what distinguishes those two sets of part numbers?) Nothing distingushes the part number other then the dates if a of when the part number was made.

Is this clear? Let me know I can clarify.
 
What field holds the date the part number was made? You have to add that criterion to at least one side of the "or" statement. What is the date criterion? Which set of part numbers then should have the date range apply?

-LB
 
lbass, let me set an example: If i had a date made field and a part number field. All my part number had a date made however in some case i want to return only the part numbers made from June 1 to June 30. The other case I would like to return all the part number made.

How would I do this?

 
What distinguishes the two cases though? If you say the date made, then all you are saying is that you want all records returned.

I wonder whether you are really trying to group on records based on whether they are in a date range or not. If so, then use a record selection formula like this:

{LaborDistribution.PartNumber} = {?Part Number Selection} and
not ({WorkCenters.WorkCenterID} startswith "9") and
{LaborDistribution.StartDate} <> {LaborDistribution.StopDate}

...since you seem to want to require this of all records, and then create a formula in the field explorer like this:

if {WOHeader.StartDate} = {?Date Range} then "In Range" else
"Out of Range"

Insert a group on this.

On the other hand, your earlier posts made it sound like you wanted some parts to show with all dates (including the date range) and some only if they fell in the daterange, and yet you have not been able to identify what distinguishes those two sets of parts. If really you are wanting to compare a subset of parts with all parts (including the subset), then you should use a subreport for the subset where you add the date range there. Place the subreport in the report header or footer, add the record selection formula to the sub, including the daterange parameter, and link the {?Part Number Selection} to each other using the dropdown in the subreport linking screen.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top