Passing parameters to sub-reports

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ColinP
Posts: 30
Joined: Thu Jul 09, 2020 7:57 am
Location: London UK

Passing parameters to sub-reports

Post by ColinP »

This must be a common requirement. Without going into details, I am presenting a report with line details which refer to all orders for a branch; grouped by customer showing product. At the end I want a summary for each product.

I FIND all the records of outstanding orders for the Branch and order them by Customer
FIND orderline WHERE orderline IN branch AND status = 'Unfulfilled' ORDER BY orderline.customer

Great - at the end I call a subreport and enter the query as
FIND orderline WHERE orderline IN branch AND status = 'Unfulfilled' ORDER BY orderline.product

It doesn't work becasue the query has no value for 'branch'

No worries - the very next question (after the sub report name) refers to the 'Subreport parameters (if any)' but the field is not accepting input.

No worries - I need to modify the sub-report to demand a parameter - in this case 'branch'

So I go over to the sub report and look for an Input field - like in a Process.

But there is nothing. There is the Data property, but that seems to duplicate the query already entered.

I'm sure when I find out how to do this I will grasp my forehead in both hands and moan - 'Why didn't I think of that?'

I have read the manual and checked all of the Forum. I feel bad for having to trouble someone for something so simple
Colin
------------------------------------------------------------------------------------------------------------------------
AwareIM 8.7 (Build3012) Windows Virtual Server Derby
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Passing parameters to sub-reports

Post by Jaymer »

here is a Query in one of my subreports:
FIND TicketItems WHERE TicketItems.ps_Ticket=TicketE AND TicketItems.LineType<'3'

I think you're leaving out the tablename in front of "branch"
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
ColinP
Posts: 30
Joined: Thu Jul 09, 2020 7:57 am
Location: London UK

Re: Passing parameters to sub-reports

Post by ColinP »

Sorry - that was careless error. I should have said

FIND orderline WHERE orderline IN branch.orderline AND orderline.status = 'Unfulfilled' ORDER BY orderline.customer
Colin
------------------------------------------------------------------------------------------------------------------------
AwareIM 8.7 (Build3012) Windows Virtual Server Derby
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Passing parameters to sub-reports

Post by Jaymer »

screen pics of the queries?
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
ColinP
Posts: 30
Joined: Thu Jul 09, 2020 7:57 am
Location: London UK

Re: Passing parameters to sub-reports

Post by ColinP »

OK - I have to come clean - I was simplifying the process to try to make things clear. It is more complicated.

We have a number of products, each product is bespoke and each has Cost Quote from multiple sources. But products are grouped and we can't place an order with the factory for some of the products in a group and not others.

You will see that it is not a question of accepting the lowest quote for each product, but the lowest overall.

The extra complication is that the customer may not order all the product in a group.

So the user has a screen based on a Product Group. All the Product/Quote combinations are related to the Product Group.

When they need to decide who they will order the goods from they have a Pick List using a Checkbox Widget, ordered by Product first then Factory. Using this they pick the Product/Quote (now called OrderLines) they want to include on the report.

Having made their selection they have a Panel Operation set to Create Document to create the report. This works fine but . . .

Embedded in this document is a subreport which provides a total of the quoted costs from each factory, this obviously has to be sorted and grouped by Factory.

The fundamental question is how can I reorder the Orderlines generated by the CheckBox Widget in the sub-report

I am pretty certain that I could start a process from the Checkbox widget to set a flag in the Orderline Record before making the CREATE DOCUMENT call. I could then extract the record I need in the subreport, but I am concerned about performance, the OrderLine Object will have many thousands of records.

So

FIND OrderLine WHERE Orderline.Flag = 'Y' ORDER BY FactoryName would be dangerous

So I tried

FIND OrderLine WHERE Orderline IN CostGroup.OrderLine AND Orderline.Flag = 'Y' ORDER BY FactoryName

But this found nothing - the CostGroup record in CONTEXT did not seem to be passed to the sub_report.

The concern is that perhaps this SHOULD work and perhaps I have made a silly error, how long to I spend looking for a slip which perhaps does not exists???

I'm stuck.

Thank you for your assistance. I am new to AwareIM and have a difficult application to develop. Baptism by fire . . .
Colin
------------------------------------------------------------------------------------------------------------------------
AwareIM 8.7 (Build3012) Windows Virtual Server Derby
ColinP
Posts: 30
Joined: Thu Jul 09, 2020 7:57 am
Location: London UK

Re: Passing parameters to sub-reports

Post by ColinP »

I have given up on this.

I am now directing the Print operation to a process which populates a temporary business object with the details I need for the cross summary, goes on to produce the report. The subreport finds all in the temporary table and sorts them.

It works, but isn't it clunky??
Colin
------------------------------------------------------------------------------------------------------------------------
AwareIM 8.7 (Build3012) Windows Virtual Server Derby
Post Reply