Show all records from Database when the reference selector is empty

0
Hi.   I have this application I am building which shows a record in a document template based upon the input variables a user submits. Its actualy a Report. For this I created an Entity that holds the Report Paramaters, such as Start_Date, End_Date so on. It is also asociated with the Projects Entity and the SubContractor Entity to retrieve the Project Names and the SubContractor Names via selecting the reference selectors. The Image Below shows the Report Parameter page where a User selects the required items for the report to show.   And here is the Report Parameter Entity: Here is the Document Template:   Here is the Microflow to get the report:   Here is the Xpath Constraint to retrieve the SubContractor Expenses in the microflow:   These are the Xpath codes that I used to retrieve the expense data: [Payment_Date>$Start_Date and Payment_Date<$End_Date] [MainModule.Supervisor1_Subcontractor_Expenses_Projects=$Report_parametres/MainModule.Report_parametres_Projects] [MainModule.Supervisor1_Subcontractor_Expenses_SubContractors = $Report_parametres/MainModule.Report_parametres_SubContractors]   Now everything works fine when I do a Report search. I can select the date range and the report shows the relevent results. And when i select the project name, it filters the other projects and shows the relevent report pertaining to the project I selected. And same for the Sub contractor name. Every thing works fine. BUT. When I need to get all the records of all the projects or all the records of all the subcontractors, I assumed if I didnt select anything in the reference selector it will work. So I kept the reference selectors empty and did a report request, but I get an Empty Report. How to get all the records when I dont need to filter them ? What am I missing in the Xpath? Please help? Regards Dylan  
asked
2 answers
0

Dilan,

When there is not value selected for the Subcontractor or Project, the Expenses retrieve action will only retrieve expenses that are not attached to one (or both) of these.  I would guess you don't have any 'unattached' expenses in your database. 

There are a number of different approaches to get all expenses.

One idea is to put an exclusive split in your data source microflow (your expenses grid is sourced from a microflow) to see if Subcontractor is empty but project is not.  In this case, you would branch to a retrieve that has the xpath you specified, but without the Subcontractor clause.  Then return the retrieved rows to your document template.  You can see that this method would also require some additional branching for the case where Project is empty but Subcontractor is not and the case where both are empty.

Others in the community will likely have some different approaches in mind.

Hope that helps,

Mike

answered
0

 

This is my new Microflow with a few Modifications to what Mike had said. And this is a Report of Labour Expenses. No need to source the document Template with the Microflow.

 

Thanks

Mike

answered