Monday, 23 March 2015

Simple Steps To Create Number Sequence In Ax2012

Number Sequence Creation:
Here I want to design a form named FirstForm with DataSource FirstTable
I want to create sequence  like "AX00001---------AX99999".

Step 1
Create an EDT - String Type
So, I created an EDT named "AXSeqEDT" with label "AX Seq"
Drag into Table(FirstTable)àFields

Step 2
Now create a new Number Sequence
Path for creating num Sequence is
"Module:: Organization administration.......Common.........Number sequences......Number sequences"
Click on New(Number Sequence)
Now number Sequence form will be opened----That contains 4 sections.
Section 1.Identification.....Specify the NumberSeqCode and Name
Section 2.Scope Parameters... Select the Scope from the Dropdown
Section 3.Segments.... Add the constant and alphanumeric (by clicking the add button and selecting from drop down)
Section 4 .General.....Checkmark for continous and Specify the "smallest and largest and Next" Fields
Now Save Ur Settings

Step 3
Now add the Respective manual-code to class - NumberSeqModuleURMODULE
And Table - URMODULEParameters.
So I am creating number sequence based on HRM Module.....So iam usingclassNumberSeqModuleHRM and TableHRMParameters
Now go to AOT---Classes-NumberSeqModuleHRM---loadModule()
Add the code here...
Note::Here we can add the code seeing the existing implementation
The Added Code is::
/* setup discussion number sequence - it is global */
    datatype.parmDatatypeId(extendedtypenum(AXSeqEDT));
    datatype.parmReferenceHelp(literalstr("@SYS32633"));
    datatype.parmWizardIsContinuous(true);
    datatype.parmWizardIsManual(NoYes::No);
    datatype.parmWizardIsChangeDownAllowed(NoYes::No);
    datatype.parmWizardIsChangeUpAllowed(NoYes::No);
    datatype.parmWizardHighest(99999);
    datatype.parmSortField(12);
    this.create(datatype);
Now Goto AOT---Tables---HRMParameters---methods-----click on new method

Add the code In the New method
Note::Here we can add the code seeing the existing implementation

The Added Code is
static client server NumberSequenceReference numRefAXSeqEDT()
{
returnNumberSeqReference::findReference(extendedTypeNum(AXSeqEDT));
}


Step 4
In order to add our newly created number sequence reference to our Module write the following Job and Execute it
Below job is important to run because without it your new number sequence will not be available to number sequence form under Parameters. This is the change in behavior from AX 2009 where all new number sequence loads while restarting the Dynamic AX. In AX 2012 all the number sequence created to system while installation, so restarting the AOS wont effect in loading the new number sequence, that is why it is important to run the job to load new number sequences.
The Code added in The Job is
static void jobName(Args _args)
{
    NumberSeqModuleHRM  NumberSeqModuleHRM = newNumberSeqModuleHRM();
    ;
    NumberSeqModuleHRm.load();
}


Step 5
Organization Administration >> CommonForms >> Numbersequences>>Numbersequences>> Generate >> run the wizard.

Step 6
Now we have to check the number sequence  is correctly working  for that write a job:

static void number(Args _args)
{
    NumberSeq  numberSeq;
    CarId num;
    ;
    numberSeq = NumberSeq::newGetNum(ProjParameters::numRefcarId());
    num = numberSeq.num();
    info(num);
}


Step 7
Now add the Code in Create method of Forms Datasource methods
Goto-AOT-Forms-FirstForm-Datasources-FirstTable-Methods-Override method(Create)
public void create(boolean _append = false)
{
    ;
super(_append);
    FirstTable.AXSeqEDT = NumberSeq::newGetNum(HRMParameters::numRefAXSeqEDT(),true).num();
}


Step 8
Now save all your settings.....Now Open our form-FirstForm


Another tutorial

Tuesday, 22 July 2014

Compact Framework Numeric Text Box

Dear All

A simple numeric text box  just add a simple text box after that create the On Key Press Event
then but the code below

 private void txtQty_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (Char.IsDigit(e.KeyChar) || Char.IsControl(e.KeyChar) || (e.KeyChar == '\b'))
            {
                e.Handled = false;
            }
            else
            {
                e.Handled = true;
            }
        }

Thanks and Regards
Hesham Hosni 

Monday, 28 April 2014

How to pass values between Axapta forms

How to pass values between Axapta forms 

void clicked()
{
    Args myArgs;
    FormRun myFormRun;
    ;
    // Keep this call to super() when overriding the clicked method.
    super();

    myArgs = new Args();

    // Provide the name of the form to launch.
    myArgs.name("WebformBarcodeBatchPrint");

    // The DataSource_WorkOrder_M data source variable name
    // represents the currently selected item in the grid
    // on the parent form (and thus in the data source).
    myArgs.record(InventBatch);

    myFormRun = ClassFactory.formRunClass(myArgs);

    // if(DataSource_WorkOrder_M.WOStatus_fn()!=WOStatus::Closed) {
    myFormRun.init();
    myFormRun.run();
    myFormRun.wait();
}

Friday, 8 February 2013

HTML5 Table Alignment


// cellpadding
th, td { padding: 5px; }

// cellspacing
table { border-collapse:separate; border-spacing: 5px; } // cellspacing="5"
table { border-collapse:collapse; border-spacing: 0; }   // cellspacing="0"

// valign
th, td { vertical-align: top; }

// align (center)
table { margin: 0 auto; }

Wednesday, 2 January 2013

JQuery Input text box Numeric Validation Integer and Decimal



///////////////////////////////////////IntegerValidation ///////////////////////////////////////////////////////
            $("#txtRequestedDays").keyup(function (e) {
                if (/\D/g.test(this.value)) {
                    // Filter non-digits from input value.
                    this.value = this.value.replace(/\D/g, '');
                }
            });


///////////////////////////////////////Decimal Validation ///////////////////////////////////////////////////////
            $("#txtRequestedDays").keyup(function () {
                if (this.value != this.value.replace(/[^0-9\.]/g, '')) {
                    this.value = this.value.replace(/[^0-9\.]/g, '');
                }
            });


Monday, 31 December 2012

Resize or Reduce Dialog of jQuery UI DatePicker plugin using CSS

Dear all
Here is a new problem that all of us can we fix and after some time we forget how to do this again so i would  like to share it with all of you
which is how to increase or decrease the JQuery date picker dialog size thorough JQuery CSS class or our CSS class by the code below as it is

In our class

<style type = "text/css">
.ui-datepicker { font-size:9pt !important}
</style>
 
Or in the jQuery UI Calendar CSS file
.ui-datepicker { font-size:9pt !important}

Wednesday, 28 November 2012

.Net Business Connector Call a static method with dynamic parameters


Dear All
  Here a sample code for how to call a static method with a dynamic parameters because by default the CallStaticClassMethod allow you to only put max three parameters

so suppose we have a method in Axapta which is take two integer parameters and return the sum of them like this :


static int myMethod(int x,int y)
{
   Return x+y;
}

and here below is how to call this method with any number of parameters


            Dim param As Object() = New Object(1) {}
            param(0) = 3
            param(1) = 2       
            Return ax.CallStaticClassMethod("HBUnderQualityMovement", "myMethod", param)

Thanks and Regards
Happy Programming :)