Friday, November 26, 2021

get selected record from Lookup



based on selected record from parent code lookup modify item id in purchase order.

create a new custom lookup form as shown below.


override closeselect   method :

Public void closeselect(str  _selectString)
{
FormRun      formrun;
Object          formrunobj;

     super(_selectString);

if(element.args() != null
    && element.args().caller() != null
   && SysDictClass::is(element.args().caller(),classnum(FormRun ))
    {
        formrun = element.args().caller();
        if(formHasMethod(formrun,identifierstr(PurchTable)))
        {
          formrunobj = formrun;
        }
}

}

override init method :

set  Autodeclaration Yes Highlited control in 

Public void int()
{
    super();
    element.selectMode(InventTable_ParentCode);
}

override runmethod :

Public void run()
{
    FormStringControl         callingcontrol;
    boolean                           filterlookup;
    FormRun                        formrun;
        
   if(element.args()  && element.args().caller())
    {
        if(SysDictClass::is(element.args().caller(),classnum(FormRun )))
        {
            formrun =  element.args().caller();
        }
    super();
    
}

call Lookup form in ParentCode control level in PurchTable form.

Public void lookup()
{
      Args       args = new Args();
     FormRun      lookupform;
    InventTable       inventTable;

    args.name(formstr(parentlookup));
    args.parm(PurchLine.ItemId);

    lookupform = new FormRun(args);
    lookupform .init();
    this.performFormLookup(lookupform);
    lookupform.wait();

    if(lookupform.closeOk())
    {
        inventTable = lookupform.docCursor();
    }

}

Get RecId from inventTable modify ItemId from modified method.

Wednesday, August 18, 2021

ComboBox filter

1. Add Enum control in Form

2 .Enum Contol AutoDeclaration property set to Yes. 

3 .in control modified method add below code.

public boolean modified()

{

     int                                ret;

    QueryBuildRange       range;

    ;

    ret = super();

    range = SysQuery::findOrCreateRange(
        purchTable_DS.query().dataSourceTable(tablenum(PurchTable)),
        fieldnum(PurchTable, PurchStatus));
    range.value(queryValue(controlname.selection()));
    purchTable_DS.executeQuery();

    return ret;
}

Friday, June 18, 2021

Some Important function

 Get Last Two Characters

Str     s = 'AXAPTA';

info(strfmt( subStr(s,strLen(s)-1,strlen(s)));

OutPut : TA

Get First Two Characters

info(strFmt(subStr(s,0,2 )));

OutPut : AX

Friday, December 4, 2020

Validate in UI Builder class

 Write below code in your UIBuilder Class

public boolean validatePostingProfile(FormStringControl  _control)

{

    boolean        ret = true;

   VendPostingProfile    vendPostingProfile;

    vendPostingProfile  = _control.valueStr();  

    if(VendLedger::find(vendPostingProfile))

    {

        if(vendPostingProfile != ' ' )

        {

        error ('Posting profile does not exist');

        ret = false;

    }

    return ret;

}


call the above method in PostBuild  method


dlgpostingProfile.registerOverrideMethod(methodStr(FormStringControl, validate), methodStr(<yourUIBuilderclass>, validatePostingProfile),this);

Tuesday, November 17, 2020

Validation on Empty space through X++

 Tables-->InventBatch-->ValidateField

 case fieldNum (InventBatch,InventBatchId):

if(strContains(this.InventBatchId," "))

{

      ret = checkFailed("Empty space is not Allowed");

}

Tuesday, May 5, 2020

SSRS Expression

Add total on Group by :

=SUM(MAX(Fields!RoundOff.Value,"LedgerVoucher"))

here LedgerVoucher is group name


Serial number on Group by :

syntax:

=RunningValue(<Grouped field>,CountDistinct,”<DataSet>”)

Example:

=RunningValue(Fields!LedgerVoucher.Value,CountDistinct,"SendingBillsDS")

Date Format : Monthname - year 

=FORMAT(Fields!ExpDate.Value, "MMM-yy")

Ex: Jan-23

Wednesday, March 4, 2020

call table level lookup method in form

EmplTable-->Method
 public client static void lookupActiveEmpId(FormStringControl _ctrl)
{
    SysTableLookup          sysTableLookup =      SysTableLookup::newParameters(tableNum(EmplTable),_ctrl);
    Query                   query = new Query();
    QueryBuildDataSource    queryBuildDataSource = query.addDataSource(tableNum(EmplTable));

    queryBuildDataSource.addRange(fieldNum(EmplTable,Active)).value(enum2str(NoYes::Yes));
    sysTableLookup.addLookupfield(fieldNum(EmplTable,EmplId));
    sysTableLookup.addLookupfield(fieldNum(EmplTable, EmplName));
    sysTableLookup.addLookupfield(fieldNum(EmplTable,Active));
    sysTableLookup.addSelectionField(fieldNum(EmplTable,EmplId));

    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}
Form-->Design String Control-->method

public void lookup()
{   
    EmplTable::lookupActiveEmpId(this);
}

update_recordset with joins

 update_recordset with joins update_recordSet storeTransfer         setting      TransactionId = transfertable.TransferId     join transfert...