Category Archives: Runbase

Uploading a ​file to FTP server through X++ using batch processing…

Hi experts,

I came with one more stuff related to the uploading file to FTP server which is using batch processing, there is a lot of code change difference in file uploading to FTP server manually and using batch processing.

A class object must have RunOn property as “Server” and every time you make changes to an object, you must generate CIL.

if you would like to debug your code while it is running using batch processing, you need to debug from Visual studio and attach process to it.

Here is a sample class which uploads file to FTP server using batch processing

Sample file upload to FTP server using batch processing

Please feel free to comment your errors or suggestions or if you would like to know how to debug batch jobs using visual studio.

Thant’s it from my side, thank you

Happy Daxing…

Advertisements

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

How to add lookup form on Runbase Dialog

Hi All,

Today, I am demonstrating on how to add lookup form on RunBase Dialog.
Firstly, I want to give a brief introduction about RunBaseBatch 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;

}

In the above class declaration, I declared dialog object of type DialogRunbase & nameField of type DialogField and then i overrided 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);
return dialog;

}

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

rivate 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.

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.

Lookup1

Suppose, If I select Add Operation from the lookup and press ok then, here it is the output.

lookup2

How to add combo box on RunBase Dialog

Hi All,

Today, I am demonstrating on how to add combo box 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 Comobox
to RunBase Dialog starts with Class Declaration.

class SampleComboDialog extends RunBaseBatch
{

DialogRunbase dialog;
DialogField operationField;

}

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

protected Object dialog()
{

dialog = super();
operationField = dialog.addField(enumStr(Operations));
return dialog;

}

In this, I assigned the Operation field which is of Type Base Enum to operationField which is of type DialogField and returned the dialog which of type object.

You can even use putToDialog() and getFromDialog() but I want to make it as simplified version. So, I wrote run() method here below.

public void run()
{
super();
info(strFmt(“the result is %1”, operationField.value()));
}

It displays the value selected in ComboBox but it requires to initialisation 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.

ComboBox

If you clicked at ComboBox, it show it list of enums.

ComboBox1

Suppose, If I select Add Operation from the ComboBox and press ok then, here it is the output.

Combobox2

That’s it, just try it and happy Daxing…….