Hi Techies,
I want to enable/disable a dynamically added data source in a code at a particular condition. If the values of the fields(FromDate and ToDate) are blank then it should be disabled else it should enable. I tried doing this ->qbds.childDataSourceNo(2).enabled(true); but it is showing error - 'Query does not contain 2 datasources'
Below is my code
QueryBuildDataSource qbds = ds.addDataSource(tableNum(LedgerJournalTrans)); qbds.relations(true); qbds.joinMode(JoinMode::ExistsJoin); qbds.addRange(fieldNum(LedgerJournalTrans,TransDate)). value(strFmt('%1..%2',formRun.parmFromDate(),formRun.parmTodate()));
Can anyone help me here,
Any response is appreciated!
Thanks
*This post is locked for comments
One solution would be keeping your joined data source, but passing dateNull() and maxDate() as the date range.
In your code you have introduced a new QueryBuildDataSource which has one data source table.
Therefore qbds.childDataSourceNo(2).enabled(true) can't work, can it? Or is qdbs referring to something else in the place where you are using it?
I want to show data according to the dates selected, in current situation- if i select these dates on form, the code is adding this data source and showing me data as required, now if I remove the dates then it should display all records on form without considering this date filter, in my condition the added data source is remaining in a query and showing previous data.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,993 Most Valuable Professional
nmaenpaa 101,156