preloader-matrix

Alfasith

X++ tutorials

Hi,
please try below code and observe the execution.
 
Conditional statement
2 table using while
int counter = 1;
while (counter <= 25)
{
print counter * 2;
counter++;
}
pause;
warning msg
Box::warning(“This is a warning message.”, “Title text”, “Help text”);
Info msg
Box::info(“Main Text”, “Title”, “This is the help text”);
YesNo msg
Box::yesNo(“Choose Yes or No”, DialogButton::Yes, “Yes No
Box Example”, “Answer Yes or No”);
Print YesNo selction in print window
DialogButton dialogButton;
dialogButton= Box::yesNo(“Choose Yes or No”,
DialogButton::Yes, “Yes No Box Example”);
if (dialogButton == DialogButton::Yes)
{
print “You chose Yes”;
pause;
}
else if (dialogButton == DialogButton::No)
{
print “You chose No”;
pause;
}
Info log
info(“This is an info infolog”);
warning
warning(“Infolog text”);
error
error(“Infolog text”);
SIMPLE DIALOG BOX
static void Simple_Dialog(Args _args)
{
dialog dialog;
dialogGroup dialogGroup;
dialogField dialogField;
dialog = new Dialog(“Simple Dialog”);
dialogGroup = dialog.addGroup(“Customer”);
dialogField = dialog.addField(extendedTypeStr(custAccount));
if (dialog.run())
{
print dialogField.value();
pause;
}
}
YesNo Box -Question
DialogButton dialogButton;
dialogButton = Box::yesNoCancel(“Do you want to continue?”,
DialogButton::Yes, “Question”, “Bottom help text”);
//(“Matter”,Default selection, “Title”);
Infolog Tree
setPrefix(“This is the Infolog Tree lab”);
info(“Info message”);
warning(“Warning message”);
error(“Error message”);
Dialogbox with 2 fields and selection results in infolog
Dialog dialog;
DialogGroup dialogGroup;
DialogField dialogFieldCustAccount;
DialogField dialogFieldSalesId;
dialog = new Dialog(“Simple Dialog”);
dialogGroup = dialog.addGroup(“Customer”);
dialogFieldCustAccount =
dialog.addField(extendedTypeStr(CustAccount));
dialogFieldSalesId =
dialog.addField(extendedTypeStr(SalesId));
if(dialog.run())
{
info(dialogFieldCustAccount.value());
info(dialogFieldSalesId.value());
}
Own applic.// to get the username and dob from user and check if no name and dob print warning else conclude dialog is yes print in another form else print only name
static void Simple_Dialog(Args _args)
{
DialogButton dialogButton;
dialog dialog;
dialogGroup dialogGroup;
dialogField dialogField1;
dialogField dialogField2;
container nameAndDOB,a;
   
dialog = new Dialog(“Date and Name”);
dialogGroup = dialog.addGroup(“Enter details”);
dialogField1 = dialog.addField(extendedTypeStr(Name));
dialogField2 = dialog.addField(extendedTypeStr(TransDate));
  
if (dialog.run())
{
print dialogField1.value();
print dialogField2.value();
  nameAndDOB = [dialogField1.value(),dialogField2.value()];
pause;
}
    if(nameAndDOB == )
    {
        Box::info(“Sorry you did’t entered your name and date of Birth”, “Message”, “This is the help text”);
       
    }
    else
    {
       
dialogButton = Box::yesNo(“Do you want to see the birthdate?”, DialogButton::Yes);
if (dialogButton == DialogButton::Yes)
{
Box::info(strFmt(“%1, %2”, conPeek(nameAndDOB,1),conPeek(nameAndDOB,2)));
}
else
{
Box::info(strFmt(“%1”,conPeek(nameAndDOB,1)));
}
}
}
Create a class;
Create 2 methods and 1 for as assigning and another for printing.
Call the class and its method.
static void Simple_Dialog(Args _args)
{
PrintMyName PrintMyName;
PrintMyName = new PrintMyName();
PrintMyName.setMyName();
PrintMyName.printMyName();
pause;
}
Method run() calls another method myMethod();
public void run()
{
this.myMethod();
}
Display(),Accessor()
Share on email
Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

Leave a Reply

Your email address will not be published.