Filter isn't working

Hi,

pastedimage1514290991548v1.png

pastedimage1514291007336v2.png

I’ve created a button to open routejournal for particular prodid, in that second form when I gave any other prodid it doesn’t filter the Routecard journal based on that id.

I declared a queryrange for prodid and gave the value as

productionRange.value(txtBarcode.text());

May I know how to fix this?

Thanks

Where you are calling this code?

What other changes you have made?

In init method of datasource i gave the range for the query as:

 productionRange = ProdJournalTable_ds.query().dataSourceTable(tablenum(ProdJournalTable)).addRange(fieldnum(ProdJournalTable, ProdId));

In executequery:

void executeQuery()
{
    ;
    journalFormTable.datasourceExecuteQueryPre();
    productionRange.value(txtBarcode.text());
    txtBarcode.text("");
    super();

    journalFormTable.datasourceExecuteQueryPost();

}

In modified method of that stringedit i called that executequery.

As there is only filtered records in the second form, I think the stringedit filter isn’t working.

May I know how to call the entire table again and filter this record based on the Prodid?

You may have to clear the existing range on PROD Id.
It is being set in journalFormTable.datasourceExecuteQueryPre();

Wr can i set this?

It is already there in executequery method of form datasource…

What shall i do now, Kranthi?

See the below example code. (you may remove the changes in executeQuery and init methods)
public boolean modified()
{
boolean ret;

ret = super();

if (ret)
{
ProdJournalTable_ds.query().dataSourceTable(tablenum(ProdJournalTable)).clearDynalinks();
ProdJournalTable_ds.query().dataSourceTable(tablenum(ProdJournalTable)).clearRange(fieldnum(ProdJournalTable, ProdId));
ProdJournalTable_ds.query().dataSourceTable(tablenum(ProdJournalTable)).addRange(fieldnum(ProdJournalTable, ProdId)).value(queryValue(this.text()));
ProdJournalTable_ds.executeQuery();
this.text(’’);
}

return ret;
}

No Kranthi, that filter doesn’t work still…

it looks like this…

You should not be processing transactions in the DAT company, just for reference.

Can you show the changes made?

Yes, Kranthi.

In datasource init method:
void init()
{

super();
journalFormTable.datasourceInitPost(prodJournalTable);
}

in executequery:
void executeQuery()
{

;
journalFormTable.datasourceExecuteQueryPre();
super();
journalFormTable.datasourceExecuteQueryPost();
}

and in stringedit modified method:

public boolean modified()
{
boolean ret;

ret = super();

if (ret)
{
ProdJournalTable_ds.query().dataSourceTable(tablenum(ProdJournalTable)).clearDynalinks();
ProdJournalTable_ds.query().dataSourceTable(tablenum(ProdJournalTable)).clearRange(fieldnum(ProdJournalTable, ProdId));
ProdJournalTable_ds.query().dataSourceTable(tablenum(ProdJournalTable)).addRange(fieldnum(ProdJournalTable, ProdId)).value(queryValue(this.text()));
ProdJournalTable_ds.executeQuery();
this.text(’’);
}

return ret;
}