Dear All,
In my form, i used only line table in data source. but i want to filter the records based on the Header table. My form has to filled based on the filter.
Any one know idea, let me know it
Regards
Smiley
Dear All,
In my form, i used only line table in data source. but i want to filter the records based on the Header table. My form has to filled based on the filter.
Any one know idea, let me know it
Regards
Smiley
This example will show how to add a filter to a form query by using a form control.
super();
salesTableDS = SalesTable_ds.query().dataSourceTable(tablenum(SalesTable));
rangeCurrencyCode = salesTableDS.addRange(fieldNum(SalesTable, currencyCode));
}
7. Override the executeQuery() method on the data source SalesTable:
public void executeQuery()
{
rangeCurrencyCode.value(queryValue(filterCurrencyCode.valueStr()));
super();
}
8. Located the control filterCurrencyCode and override the modified() method:
public boolean modified()
{
boolean ret;
ret = super();
SalesTable_ds.executeQuery();
return ret;
}
9. Save the form and create a menu item for the form.
If you have a relation between the header table and line table, then in the line table your related field will show the lookup of the header table and hence the form which contains only the line table as the datasource will be filled on the basis of the header table lookup.
In my material form, i’m using only material line. but material master form using both material table and materiel line. if material table status is close, that records come into the material form.
how it possible
In my material form, i’m using only material line. but material master form using both material table and materiel line. if material table status is close, that records come into the material form.
how it possible
datasourcename.thetypeyouwanttouse(Tablename.fieldname == enumname::option ? false : true);
sorry… i didn’t understand. please explain it
thetypeyouwanttouse----- i want to know about this.
In Material Master
Material table and Material Line having same field as Master id.
Material table status change into close.
that close records, come under the Material form in initial state. but i’m using only Material Line table.
please tell any idea
Hello Smiley,
Suppose you are having the Primary Key field MaterialId in the MaterialTable table. This field you also have in the MaterialLine table. The lookup of the MaterialId field in the MaterialLine table should be such that only those records of the MaterialTable should be shown for which the enum field “Status” of the MaterialTable has the value “Close”. Let’s say this “Close” enum value is 1.
Then you have to create a new Normal relation with a related field fixed conditional relation on the MaterialLine table as shown below. Let’s say the name of the relation is MaterialTable.
MaterialLine.MaterialId == MaterialTable.MaterialId
1 == MaterialTable.Status
Related field fixed relation: Restricts the records selected in the related table. Only records that meet the condition are selected. The condition is ANDed with your relation.
This relation can also be created on the EDT of the MaterialId field, it depends on what exact requirement you have.
Hai Smiley,
You can use the select query as follows,
Select material table where materialtable.id == materialline.id && materialid.status == Status::close;
Now, the fields in the material table with the status option = close will be selected .
Now, assign the fields you want to display in the control in the grid you arr using…
Hello Smiley,
Please clarify the below doubts regarding your post:
Your Material master form has datasources MaterialTable in the Header and MaterialLine in the Lines. Do you want to apply the restrictions on new records when creating new lines in the Material master form ? The restrictions such that new lines should be created only for those MaterialTable records for which the enum field “Status” of the MaterialTable has the value “Close”.
Do you want that the Material form which contains only MaterialLine as the data source should display only those already created records for which the enum field “Status” of the MaterialTable has the value “Close”?
Can you create new records in the Material Form independently without creating a MaterialTable record? Do you want a lookup for the MaterialId field in this form such that such that only those records of the MaterialTable should be shown for which the enum field “Status” of the MaterialTable has the value “Close”?
Hi everybody,
Thanks for your ideas. now i changed my form similar to purchlineopenorder. But Master Table status- closed doesn’t filter into my form. how can i filter those records into my form.
i wrote coding in my form init()
MaterialTable_ds.query().dataSourceTable(tablenum(MaterialTable)).addRange(fieldnum(MaterialTable, status)).value(queryValue(status::close));
but is not working plz tell any idea
Thanks Smiley
Hi Smiley,
When you want to move the records? After clicking the button or by which environment, you are trying to move it…Or after the status has been changed to close, that record has to move to another form? What is ur exact requirement?
Hi Enrique,
yes , after status has to changed to close, the records has to be move into another form.
Here is one small example for your question.
HRMApplication _HRMApplication;
UB_Shortlist _UB_Shortlist;
object caler = element.args().caller();
;
_HRMApplication = element.args().record();
super();
if(caler)
{
if(caler.name() == formstr(UB_HRMApplication1))
{
_HRMApplication.status = HRMapplicationstatus::Shortlisted;
_UB_Shortlist.hrmApplicationId = _HRMApplication.hrmApplicationId;
_UB_Shortlist.insert();
}
}
}
This is written in Datasource init method…
I think this will help you…