Filtering grid

Hello All,

Please see below

void clicked()

{ while select * from summaryTable

where summaryTable.FIMMWeeklyHours > 18

{

summaryProjId += summaryTable.FIMMCourseProjId + ‘,’ ;

}

qrysummaryProjId = subStr(summaryProjId,1,strLen(summaryProjId)-1);

qbr2.value(qrysummaryProjId); // I want this value to be displayed in the Grid when clicked on command button

FIMMSummarizationTable_ds.executeQuery();

super();

}

init method:

qbr2=this.query().dataSourceName(‘FIMMSummarizationTable’).addRange(fieldNum(FIMMSummarizationTable,FIMMCourseProjId));

Please let me know if this will work, it is not working on my end.

Thanks in advance

Regards

Shankar Iyer

(Moved from a thread about creating an empty line.)

What are you trying to achieve? Why are you creating that silly string instead of joining FIMMSummarizationTable with summaryTable and filtering by FIMMWeeklyHour?

Hi Shankar Iyer,

If you don’t have the relationship between the tables, please add the relationship between the tables “'FIMMSummarizationTable” and “summaryTable” by using the field FIMMCourseProjId.

Add the two tables in the form datasource and join these tables by using joinsource propery of the datasource.

use the filter like

qbr = qbd.addRange(FieldNum(CustTable, AccountNum));
qbr.value(">=4000"); // Default operator is ==.

qbr2=this.query().dataSourceName(‘summaryTable’).addRange(fieldNum(summaryTable,FIMMWeeklyHours));

qbr2.value(’>18’)

Thanks,

Hari

Thanks for reply everyone.

Guys, My bad - summary table and FIMMSummarizationTable is the same table… I apologize for that…

@Martin, @Hari

What are you trying to achieve? // Question from Martin

Problem statement: My form has a grid and a command button. I will write the query in clicked method of command button and it should filter the Grid when clicked on command button

Why are you creating that silly string instead of joining FIMMSummarizationTable with summaryTable and filtering byFIMMWeeklyHour? // Question from Martin

I hope I answered this now

////////////////////////////////////////////////////Please see the code below///////////////////////////////////////////////////////////////////////////////////////////////

Please note that // - anything written after this is explanation of the above line of code

void clicked()

{ // variable decleration

// table deceleration

while select * from summaryTable

where summaryTable.FIMMWeeklyHours > 18

and summaryTable.FIMMWeeklyHours < 25

{

summaryProjId += summaryTable.FIMMCourseProjId + ‘,’ ;

// explaination of the above line of code

// summaryProjId =(“FCM-0066-001”, “FCM-0066-002”,“FCM-0066-003”,) … one comma remains in the end as it is a while loop

}

qrysummaryProjId = subStr(summaryProjId,1,strLen(summaryProjId)-1);

// explaination of the above line of code

// Used substr to remove that last comma remained in the while loop output

qbr2.value(qrysummaryProjId);

// explaination of the above line of code

// So basically qbr.value() is a collection of FIMMCourseProjId

// qbr2.value(“FCM-0066-001”, “FCM-0066-002”,“FCM-0066-003”)

// I want this value to be displayed in the Grid when clicked on command button

FIMMSummarizationTable_ds.executeQuery();

super();

}

init method:

qbr2=this.query().dataSourceName(‘FIMMSummarizationTable’).addRange(fieldNum(FIMMSummarizationTable,FIMMCourseProjId));

This time around I have tried to be as descriptive as I can… I hope everyone will understand my problem statement and explanation of each line of the code… Still if anyone has questions, I will be more than happy to answer

Thanks all in advance for your valuable time

Regards,

Shankar Iyer

Can you explain why you can’t simply filter FIMMSummarizationTable by FIMMWeeklyHours?

I don’t need you to explain me what’s a variable declaration and what subStr() does. Forget about your code and explain you’re trying to achieve, okay?

Hi Shankar Iyer,

Ok. Then, you can filter the records directly.

like

//FIMMSummarizationTable_ds execute query
public void executeQuery()
{
qbr2=this.query().dataSourceName(‘FIMMSummarizationTable’).addRange(fieldNum(FIMMSummarizationTable,FIMMCourseProjId));
super();
}

void clicked()
{
qbr2.value(’>18’);
FIMMSummarizationTable_ds.executeQuery();
super();
}

Thanks,

Hari