DEV Community

Rohith_Veerapalli
Rohith_Veerapalli

Posted on

DB Sync via code with using parameter

class AT_DBSync extends RunBase
{

    DialogField text;
    public boolean getFromDialog()
    {
        str fil = text.value();
        return super();
    }

    /// <summary>
    /// Class entry point. The system will call this method when a designated menu
    /// is selected or when execution starts and this class is set as the startup class.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {
        AT_DBSync sync = new AT_DBSync();
        sync.sync();
    }

    public void sync()
    {
        Dialog           dialog =    new Dialog("Upload file");
        DialogGroup                             dlgUploadGroup;
        FormBuildControl                        formBuildControl;
        FileUploadBuild                         fileUploadBuild;

        dlgUploadGroup          = dialog.addGroup("File");
        formBuildControl        = dialog.formBuildDesign().control(dlgUploadGroup.name());
        fileUploadBuild         = formBuildControl.addControlEx(classstr(FileUpload), 'Upload');
        text = dialog.addField(extendedTypeStr(String50), 'Table name');

        if (dialog.run() && dialog.closedOk())
        {
            str fil = text.value();
            int i = tableName2Id(fil);
            appl.dbSynchronize(i);
        }
    }

}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)