One small doubt in ax

Hi,

Can anybody tell me how to open the form as empty even though the datasource has some data.Actually i wrote in the form init level and datasource init level as,

Tablename.fieldname 1= " ";

Tablename.fieldname2 = " ";

etc like this.But it is not working.pls help me in this.

Hi,

Can anybody tell me how to open the form as empty even though the datasource has some data.Actually i wrote in the form init level and datasource init level as,

Tablename.fieldname 1= " ";

Tablename.fieldname2 = " ";

etc like this.But it is not working.pls help me in this.

HI Ramyasrilakshmi,

In the execute query method of the datasource in the form… write this tablename.clear() after the super()…

public void executeQuery()
{
super();
tablename.clear();
}

Naresh Kolli

Hi,

Thanks for your reply.I was using this clear() also in the init() and it was not working.But when i used this clear() in executequery it is working.But in my case i am having the edt field with the lookup above the grid there i should show the value only in grid it should be empty when i am opening the form.

help me in this

Hi Ramyasrilakshmi,

In the executequery() of the form datasoure method

public void executeQuery()
{
EmpId empId; //declare the lookup field in the form above the grid as example

super();
if(!EmpIdLookup.valueStr())
{
EmpTable.clear();
}
if(EmpIdLookup.valueStr())
{
empId = EmpIdLookup.valueStr(); // assign the value given in the lookup field to declared variable in the above…
select * from empTable // select * from tablename where tablename.field == above variable[assigned the lookup value]
where empTable.EmpId == empId;
Grid_Data.dataSourceempTable);
//[ Grid_Data is the Grid name in the design - make auto declaration to yes as useas…Grid-Data.datasource(tableName)]
}
}

In the modified() method of the lookup field above grid in the design of the form as [need to call the executequery() ]

public boolean modified()
{
boolean ret;

ret = super();
EmpTable_ds.executeQuery(); // tableName_ds.executeQuery();

return ret;
}

Naresh Kolli

Hi,

Actually what u gave is working.Actually my requirement is that.there is a edt field such as assetType above the grid it has been already attached to the grid records.So when we are opening the form initially only the asset type value in that lookup should be visible not the records.

Help me in this.

It is so urgent.help me in this.

Hi Ramyasrilakshmi,

Actually i didnt get you…you are saying the value in the lookup field should be shown when opening the open…but the grid values shouldn’t be shown…Can you explain some detailed…

Naresh Kolli

Ya what u understood is correct.It should retain only that asset type field above the grid the records should be invisible when we are opening.

Hi Ramyasrilakshmi,

AssetType field , if it of type baseEnum then the default values be coming…

If it is of EDT…then which value need to be filled in that field[ having one than one value]…

Naresh Kolli.

Hi,

I have a field AssetType above the grid.And i am choosing the value in that edt lookup then coming to that grid and entering the records to the corresponding asset type such as characteristic id etc and closing the form.So again when i am opening the form for new records,only it should retain the asset type selected value(which i selected before for the records) the records in the grid should not be shown.

if any idea pls help me in this.

I have a field AssetType above the grid.And i am choosing the value in that edt lookup then coming to that grid and entering the records to the corresponding asset type such as characteristic id etc and closing the form.So again when i am opening the form for new records,only it should retain the asset type selected value(which i selected before for the records) the records in the grid should not be shown

Hi Ramyasrilakshmi,

To retain last values need to implment the pack and unapck methods in the form and use xSysLastValue::saveLast(this); in the close() method of the form and xSysLastValue::getLast(this); in the init() method of the form…

Naresh kolli

Hi,

I have applied what u told me.But all the records are coming with this asset type value.

Hi,

write the below code in init method.

Table_ds.query().dataSourceNo(1).addRange(fieldnum(Table,field)).value(enum2str(enumname::element));

Regards,

S.Kuppusamy

Hi,

Code the below one in init method of the form.

Table_ds.query().dataSourceNo(1).addRange(fieldnum(Table,Field)).value();

Regards,

S.Kuppusamy