HI, I have a piece of code
int x =0;
do
{
var y = queryRun.next();
table1worker = queryrun.get(tableNum(table1), 1);
table2person = queryrun.get(tableNum(table2), 1);
x++;
} while(x < 45);
I know that I should be getting 46 records.
My main code should be --
do
{
table1worker = queryrun.get(tableNum(table1), 1);
table2person = queryrun.get(tableNum(table2), 1);
x++;
} while(queryrun.next());
I can see in the first piece that the 38th record returns false and the nfrom the 39th record it starts returning true..
I could see that table 1 worker is returned as no data selected for the 38th record..
The sql statement has cross joins..
What could be the possible reason for this.
Because of this my main loop is failing after 37 iterations and I am not able to get the other records
Hi Sidharth_j,
Is the issue got resolved?
Thanks,
Girish S.
Populating data to form at run time will effect your form performance.
But I will give you a suggestion.
Correct me if I am a wrong. You have build a query run which has list of tables and data - Based on that query run you need to loop through it and insert record in form datasource tables. If yes try the below steps.
Try to add the code in the form init method. Also no need to get the query run from the form datasource. You are trying to get the query run from the form datasource which doesn't have data.
Please see the below code.
Public void init() { Table1 table1worker; Table2 table2person; Query query = new Query(); QueryBuildDataSource qbdsTable1, qbdsTable2; QueryRUn qRUn; super(); qbdsTable1 = query.addDataSource(tableNum(Table1)); qbdsTable2 = qbdsTable1.addDataSource(tablenum(Table2)); qbdsTable2.relation(true); qRUn = new QueryRun(query); while(qRun.next()) { table1worker = queryrun.get(tableNum(table1), 1); table2person = queryrun.get(tableNum(table2), 1); //assign the values to table field //insert your data in the form datasource tables. } }
Thanks,
Girish S.
So we need to populate the form with the data that we get from queryrun
So why you are populating the data via form?
Is there any specific reason?
Thanks,
Girish S.
We are trying to populate a gantt calendar cross company
and we are trying to do it via query run.
Normally we are able to do it using inline sql but we want to do it via queryrun as well
Can you explain me the functionality you are doing?
You are adding a query run looping in the form execute query method which is not recommended, because the execute query will be called multiple times and each time your query run will be looped.
If you explain your functionality then I will give you a suggestion based on that.
Thanks,
Girish S.
[DataSource]
class table1
{
public void executeQuery()
{
var employmentDS = this.query().dataSourceTable(tableNum(tablex));
employmentDS.clearRange(fieldNum(tablex), LegalEntity));
this.populateWorkerData(table1_ds, LegalEntity);
}
private void populateWorkerData(FormDataSource dataSource, CompanyInfoRecId _legalEntity)
{
QueryRun queryRun = dataSource.queryRun();
do
{
table1 worker = queryRun.get(tableNum(table1), 1);
table2 person = queryRun.get(tableNum(table2), 1);
} while(queryRun.next());
}
}
Not able to use the rich txt formatting sorry.
This is my first post not sure how to do it..
Ive tried to make it as readable as possible.
Can you show me your full code?
Also try use rich formatting option to insert code which will be easily readable.
Thanks,
Girish S.
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,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156