Thursday, 28 August 2014

Creating an InfoPart Showing SalesOrder and SalesName in FactBox for a Customer

                        Creating FactBox and InfoPart

Scenario:
Go to AR and AllCustomers and select a purticular customer , then it should show the SalesOrder and SalesName in an InfoPart in FactBox of that form.
 
Solution:
* The FactBoxes can be created only in ListPage forms.
 
*Find which are all the tables and forms are required to this task
So lets find it by giving ViewDetails and Personalise of each field we reqired
*The Required Tables and form are
1.CustTable
2.SalesTable
3.CustTasbleListPage form
Step1:
*Create a new query and add CustTable as parent Datasourse and SalesTable as child Datasourse and give Normal relation for CustAccount and AccountNum fields of both tables


Step2:
*Create a new Part in AOT then set properties like Name ,Caption(salesinfo),Querry

*Create new Group(LayOut-->rt clik-->new group-->Group1) and set the Repeating property of Grup1 as Yes.


We need to diplay SalesOrder(related to salesTable-->salesid ) and Name(salesTable-->SalesName) in the InfoPart

So
*Create new field(Group1-->r.c-->new field) set the properties, DataSourse, DataField,Name
 
do the same for SalesName field also.
Step3:
*Add the Part to the AOT-->MenuItem-->Display
 

Step4:
*Add the menuitem(SlsInfopart) to the CustTableListPage form's Part node and set the property
DataSourseRelation:EDT.CustTale.AccountNum

Now Ipoen the form and The Fact Box will show the info part "salesinfo" which displays SalesOrder and SalesName
 

 
 

Tuesday, 12 August 2014

Generating a Dialog Form Using RunBase Class



               Generating a Dialog Form Using RunBase Class

Requirement

* Create a Dialog form using Dialog Class with 2 fields “AccountNumber ” and “CustName”
*AccountNumber” field should enable Customer lookup(can use existing EDT) and whenever selecting a purticular customer ,the CustomerName should automatically displayed in “CustName” field.

Step1:
Create a New class which extends the Runbase class …..mandatory
class Dialogingnew extends RunBase
{
DialogField CustAccount;
DialogField CustName;
Dialog dialog;
}
Step2:
write dialog() method in the class …..mandatory
protected Object dialog()
{
dialog= super();
dialog.allowUpdateOnSelectCtrl(true);
CustAccount = dialog.addField(extendedTypeStr(CustAccount)," AccountNumber");
CustName = dialog.addField(extendedTypeStr(Name),"CustName");
return dialog;
}

 
Step3:
Write dialogpostRun() method
public void dialogPostRun(DialogRunbase newdialog)
{
super(newdialog);
 
newdialog.dialogForm().formRun().controlMethodOverload(true);
newdialog.dialogForm().formRun().controlMethodOverloadObject(this);
}
 
Step4:
Write the user defined method called fld1_1_modified()
public boolean fld1_1_modified()
{
FormStringControl control = dialog.formRun().controlCallingMethod();
boolean isFieldModified;
isFieldModified = control.modified();

if(isFieldModified)
{
CustName.value(custTable::find(control.text()).name());
}
return isFieldModified;
}
 
 
Step5:
write pack() and unPack() method …..mandatory
Pack
public container pack()
{
return connull();
}
UnPack
public boolean unpack(container packedClass)
{
return true;
}
 
Step6:
Write User defined method “..description..
static client server ClassDescription description()
{
return "CustomerId and Name";
}
 
 
Step7:
write the main() method with object creation for the your class…..mandatory
public static void main(Args args)
{
Dialogingnew dialoging;
dialoging = new Dialogingnew();
if(dialoging.prompt())
{
dialoging.run();
}
}
Now Run the class and select a particular AccountNumber then the name will be displayed in CustName field
 

Note:

**There is no override Modified method in class level, so we need to write the user defined Modified method [ fld1_1_modified()].
 
**For running this user defined method, we need to write another method called as dialogpostRun()

**Description() method is to give description for your dialog form.








 

Monday, 11 August 2014

Creation Of Custom "LookUp Form"


                  Creating A lookUp Form On a Form Control

Now we are going to enable a LookUpForm on a form level bounded control.

Requirement:
Create a form(CusttForm) with a control named “id” and it should enable a form lookup (lookup form) having two fields Customeraccount and Name
 
 
Step1:

 
Create a form(CusttForm) with data source as custTable. Add the AccountNum field and Name(method) from custTable to this form Design -->Grid control.

Step2:
   
Change the CusttForm's  Design--> Property--> “Style:LookUp”



Step3:

Create a table[AssesTable] with a field “id” which extends your own EDT and add this table into a new form's[ AssesForm], and add “id” field to Design-->'Group' control as String edit control.





Step4:

write Lookup(override) method in the above control with following code

public void lookup()

{

Args args = new Args("CusttForm");

FormRun FR;

CustTable custTable;

args.caller(this);

FR = new FormRun(args);
FR.init();

this.performFormLookup(FR);

}

or

public void lookup()

{

FormRun formRun;

Args args;

args = new Args("CusttForm");

formRun = classFactory::formRunClassOnClient(args);

formRun.init();

this.performFormLookup(formRun);

}


Step5:
write a piece of code in run method as follows, in CusttForm--->Methods

public void run()

{

element.selectMode(CustTable_AccountNum);


super();

}
 
 
 




 
 
 
 
 
 
 
 
 
 
 
 
Note:

When ever we are writing lookup method , the form lookup will be enabled, but the selected value won't come to the “ id” control.


To get that selected value in control level , we are writing the “element.selectmode.(controlName)” in run method.



--->Now open the assesForm and check the working of lookup form