Thursday, February 17, 2022

Get the data from unmapped field into entity.

 Hi Guys, I added a new unmapped field in the Data entity. I need to get the data from user input(excel or XML).

Data : WHS1;WHS2;WHS3.

Entity methods:

public boolean insertEntityDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx) { boolean ret; ret = next insertEntityDataSource(_entityCtx, _dataSourceCtx); if (ret && _dataSourceCtx.name() == dataEntityDataSourceStr(MyEntity, MYDataSource) && this.MyField) { this.operation(_dataSourceCtx); } return ret; } public boolean updateEntityDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx) { boolean ret; ret = next updateEntityDataSource(_entityCtx, _dataSourceCtx); if (ret && _dataSourceCtx.name() == dataEntityDataSourceStr(MyEntity, MYDataSource) && this.MyField) { this.operation(_dataSourceCtx); } return ret; } private void operation(DataEntityDataSourceRuntimeContext _dataSourceCtx) { MyClass myClass = MyClass::construct(_dataSourceCtx);// my class myClass.getData(this.MyField); }

My custom class:

public class MyClass
{
Common     common;

public static MyClass construct(DataEntityDataSourceRuntimeContext _dataSourceCtx)
{
    return new MyClass(_dataSourceCtx);// getting entity data source
}

protected void new(DataEntityDataSourceRuntimeContext _dataSourceCtx)
{
    common = _dataSourceCtx.getBuffer();
}

public void getData(Str    _Warehouse)
{
    Str         warehouse;
    container   pack = str2con(_Warehouse, DirUtility::ListDelimiter);
                         //ListDelimiter ';'

    for (int i = 1; i <= conLen(pack); i++)
    {
        warehouse = conPeek(pack, i);

        if (!warehouse)
        {
            continue;
        }
        // you're logic
    }
}
}
I am getting the data like this. The above code is used to get this type of data and do the
opration.

Keep Daxing!!

No comments:

Post a Comment