Hi Experts,
I have created my custom Table and Entity. When I am entering the Percentage field value in form then Qty field automatically update. But when I am doing the same through entity the Qty field not updating. I have written the update code in Table - modifiedField method.
Can anyone help me on this.
Hi Mohit,
Yes this code works.
Thanks!!
That's right, initValue will not accept fieldId. Please try below code.
public void mapEntityToDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx) { DataEntityDatabaseOperation dbOp = _entityCtx.getDatabaseOperation(); stockPredictions_CAP stockPredictions; super(_entityCtx, _dataSourceCtx); if (dbOp == DataEntityDatabaseOperation::Insert || dbOp == DataEntityDatabaseOperation::Update) { switch (_dataSourceCtx.name()) { case dataEntityDataSourceStr(YourCustomDataEntity, DataEntityDataSource): CustomDataEntityName customDataEntityRecord = _entityCtx.getEntityRecord(); stockPredictions = _dataSourceCtx.getBuffer(); stockPredictions.Group1Percent = customDataEntityRecord.Group1Percent; stockPredictions.modifiedField(fieldNum(stockPredictions_CAP, Group1Percent)); } } }
Hi Mohit,
InitValue method of data entity is not accepting FieldId-->
public void initValue(FieldId _fieldId)
{
super(_fieldId);
switch(_fieldId)
{
Instead of calling at validateWrite, can you try initValue or mapEntityToDataSource method of Data entity. And is it working in validateWrite?
I will use insert or update table method for this scenario.
Hi Girish,
Actually I am calling table ModifiedField method from the Entity validateWrite().
public boolean validateWrite()
{
boolean ret;
StockPredictions_CAP stockPredictions_CAP;
ret = super();
stockPredictions_CAP.modifiedField(StockPredictions_CAP.Group1Percent);
return ret;
}
Hi Harish,
Modified field is an event and it will be triggered when field is modified. But you are talking about the data entity - Can you tell me how you are modifying the records using data entity?
Thanks,
Girish S.
Thanks Mohit.
I will apply this .
Hi Harish, ModifiedField is a table method and won't be called automatically. However, I think you can call it inside Data Entity method like MapEntityToDataSource by providing table and field name.
André Arnaud de Cal...
291,996
Super User 2025 Season 1
Martin Dráb
230,853
Most Valuable Professional
nmaenpaa
101,156