印仔 发布的文章

For paging in X++ Query. There are three steps required. Rest of Query Code is same.

We have to set following things in Query data source

Set Sort field in Query data Source.
Paging position property of QueryRun is set to true.
Add page range with starting position and number of records in QueryRun
Here is code snippet

QueryBuildRange qbr,qbrStartDate,qbrEndDate; QueryBuildDataSource qbd; IAPageSize EnumPageSize; QueryRun qr; Query query = new Query(); Int pageSize = 2; qbd = query.addDataSource(TableNum(ProjPlanVersion)); qbd.addOrderByField(fieldNum(ProjPlanVersion,HierarchyId)); qr = new QueryRun(query); qr.enablePositionPaging(true); CurrentPageNumber =1; startingposition = CurrentPageNumber * pagesize; qr.addPageRange(startingposition, totalRows); while(qr.next()) { Info (“”); }

http://axhelper.com/?p=33322

SecurityUserRole securityUserRole;
SecurityRolePrivilegeExplodedGraph securityRolePrivilegeExplodedGraph;
SecurityPrivilege securityPrivilege;
select firstonly securityUserRole

join securityRolePrivilegeExplodedGraph
    where securityRolePrivilegeExplodedGraph.SecurityRole == securityUserRole.SecurityRole
join securityPrivilege
    where securityPrivilege.RecID == securityRolePrivilegeExplodedGraph.SecurityPrivilege
    && securityUserRole.User == curUserId()
    && securityPrivilege.Identifier == “”

static void CreateAlertUsingCode(Args _args)
{
EventInbox inbox;
;
inbox.initValue();
inbox.ShowPopup = NoYes::Yes;
inbox.Subject = "This is the Alert subject";
inbox.Message = "This is the Alert message";
inbox.AlertedFor = "This alert is just information no links are available";
inbox.SendEmail = false;
inbox.UserId = curuserid();
inbox.TypeId = classnum(EventType);
inbox.AlertTableId = tablenum(Address);
inbox.AlertFieldId = fieldnum(Address, Name);
inbox.TypeTrigger = EventTypeTrigger::FieldChanged;
inbox.CompanyId = curext();
inbox.InboxId = EventInbox::nextEventId();;
inbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();
inbox.insert();
}

https://www.theaxapta.com/2012/11/create-alert-using-x-codes.html

public static string toXML(Object obj)
{
    string ret;

    XmlSerializer serializer = new XmlSerializer(obj.GetType());
    using (StringWriter writer = new StringWriter())
    {
        serializer.Serialize(writer, obj);
        ret = writer.ToString();
    }
    return ret;
}