web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Behind AX / AXAPTA - Pack-unpack at forms

AXAPTA - Pack-unpack at forms

metin emre Profile Picture metin emre 502

ClassDeclaration method:

    str dummy;
    #DEFINE.CurrentVersion(1)
    #LOCALMACRO.CurrentList
        dummy,
        packedQuery
    #ENDMACRO


Other methods:

container pack()
{
    ;
    dummy      = txtDummy.valuestr();
    return [#CurrentVersion,#CurrentList];
}


public boolean unpack(container _packedClass)
{
    int version = conPeek(_packedClass,1);

    switch (version)
   {
        case #CurrentVersion:
            [version,#CurrentList] = _packedClass;
            break;
        default:
            return false;
    }
    return true;
}


public void init()
{
    ;
    xSysLastValue::getLast(this);
    super();
    txtDummy(dummy);
    element.initQuery();
}


public void close()
{
    super();
    xSysLastValue::saveLast(this);
}


void initParmDefault()
{
}


private IdentifierName lastValueDesignName()
{
    return '';
}


private IdentifierName lastValueElementName()
{
    return this.name();
}


private UtilElementType lastValueType()
{
    return UtilElementType::Form;
}


private UserId lastValueUserId()
{
    return curuserid();
}


public dataAreaId lastValueDataAreaId()
{
    return curExt();
}


This method is not mandatory, but you may write like this if you would like to use query:

void initQuery()
{
  Query                q;
  QueryBuildDataSource qbds;
  QueryBuildDataSource qbds2;
  QueryBuildRange      qRange;
  ;
  if (packedQuery)
      qRun = new SysQueryRun(packedQuery);
  else
  {
      q = new query();
      qbds = q.addDataSource(tablenum(EmplTable));
      qRun = new SysQueryRun(q);
  }
  qRun.promptLoadLastUsedQuery(false);
}


This one is for select button of query, so of course not mandatory too:
 void clicked()
{
    ;
    super();
    if (qRun.prompt())
        packedQuery = qRun.pack();
}


This was originally posted here.

Comments

*This post is locked for comments