Creating an unbound enum like ALL,OPEN,POSTED in a form, and how to do filteration
Creating an unbound enum like ALL,OPEN,POSTED in a form, and how to do filteration:
Add unbounded comboBox - Provide property enumtype as AllOpenPosted.
In form ->
public class FormRun extends ObjectRun
{
QueryBuildRange criteriaPosted;
AllOpenPosted allOpenPostedValue;
NoYes openLinesForm;
boolean allowCreate;
}
void bookReSearch()
{
INC_Pricecontract_ds.research();
}
public void init()
{
allowCreate = true;
super();
allOpenPostedValue = AllOpenPosted::Open;
INC_Pricecontract_ds.allowCreate(allowCreate);
allOpenPosted.selection(allOpenPostedValue);
allOpenPosted.selectionChanged();
}
In Form->Datasource->
public void init()
{
super();
criteriaPosted = INC_Pricecontract_ds.query().dataSourceTable(tablenum(INC_Pricecontract)).addRange(fieldnum(INC_Pricecontract,Posted));
}
int active()
{
int ret;
ret = super();
INC_Pricecontract_ds.allowEdit(!INC_Pricecontract.Posted);
// + My Comment (Added by incadmin - INC-vinod - Start 16/10/2018)
if(INC_Pricecontract.INC_DeliveryType == INC_DeliveryType::Delivery && Grid_INC_LocationId.valueStr() == "")
{
Grid_INC_LocationId.mandatory(true);
}
else
{
Grid_INC_LocationId.mandatory(false);
}
// - My Comment -INC-Vinod - End
element.updateLinesButton();
return ret;
}
public void create(boolean _append = false)
{
if (allOpenPosted.selection() == AllOpenPosted::Posted)
return;
super(_append);
}
In Form-> Design-> Unbounded ComboBox ->
public boolean modified()
{
boolean ret;
ret = super();
this.selectionChanged();
INC_Pricecontract_ds.executeQuery();
return ret;
}
int selectionChange()
{
int ret;
ret = super();
this.selectionChanged();
INC_Pricecontract_ds.executeQuery();
return ret;
}
/// <summary>
/// Updates criteria query range and sets create permission for data source.
/// </summary>
public void selectionChanged()
{
switch (allOpenPosted.selection())
{
case AllOpenPosted::All :
criteriaPosted.value('');
break;
case AllOpenPosted::Open:
criteriaPosted.value(queryValue(NoYes::No));
break;
case AllOpenPosted::Posted :
criteriaPosted.value(queryValue(NoYes::Yes));
break;
}
INC_Pricecontract_ds.allowCreate(allowCreate && allOpenPosted.selection() != AllOpenPosted::Posted);
}
In Form->Actionpane->Line menuitembutton -> Clicked()
void clicked()
{
if (!INC_Pricecontract.RecId)
{
INC_Pricecontract_ds.write();
}
super();
}
Comments
Post a Comment