How to modify the dialogfield when other dialogField is changed on Runbase

Hi All,

Today, I am demonstrating on How to modify the dialogfield when other dialogField is changed on RunBase Dialog.

Firstly, I want to give a brief introduction about RunBase Class.
This Class is used to schedule the batch jobs. So, Adding lookup form
to RunBase Dialog starts with Class Declaration.

class SampleComboDialog extends RunBaseBatch
{

DialogRunbase dialog;
DialogField nameField;
DialogField messageField;

}

In the above class declaration, I declared dialog object of type DialogRunbase & nameField of type DialogField, messageField of type DialogField and then I overrided dialog method.

Don’t forget to put dialog.allowUpdateSelectCtrl(true) in dialog() method
protected Object dialog()
{

FormStringControl control;
dialog = super();
namefield = dialog.addField(extendedTypeStr(Name));
control = namefield.control();
control.registerOverrideMethod(methodStr(FormStringControl,lookup),
methodStr(SampleComboDialog,nameLookup),this);
messageField = dialog.addfield(extendedTypestr(Description));
dialog.allowUpdateOnSelectCtrl(true);
return dialog;

}

You have to override the lookup() method with lookup form being as parameter.

private void nameLookup(FormStringControl _control)
{
SysTableLookup sysTableLookup;
QueryBuildDataSource qbds;

Query query = new Query();
qbds = Query.addDataSource(tableNum(SampleAIFTbl));
sysTableLookup = SysTableLookup::newParameters(tableNum(SampleAIFTbl), _control,true);
sysTableLookup.addLookupfield(fieldNum(SampleAIFTbl, Name), true);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();

}

Binding this nameField with FormStringControl, used registerOverrideMethod to be used as overridden method by dialog object.

dialogSelectCtrl() method shows the value passed to it whenever its control selected by user.

public void dialogSelectCtrl()
{
str msg = nameField.value();
super();

messageField.value(msg);
}

//Simple run method
public void run()
{
super();
info(strFmt(” the result is %1″, nameField.value()));
}

It displays the value selected in lookup but it requires to initialization of RunBase Class Object. This is has to be written in main method of respective class.

public static void main(Args _args)
{
SampleComboDialog sampleComboDialog;
sampleComboDialog = new SampleComboDialog();

if(sampleComboDialog.prompt())
{
sampleComboDialog.run();
}
}

So, I compile & run it and here is the Output.

Capture1
When I select some value from lookup and select Description Dialog field, it will show as it below.

capture2

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: