X++ code to Create Cue in DAX 2009

RoleCente's main purpose is to show various data on homepage which user will get to see all at a glance . Cue is also one among them .
Basically Cues in DAX 2009 are used for visual representation of data . In Technical terms Output of Query is represented graphically.

How Cue Works 
1. Open PurchTable form , click on advanced filter (Ctrl + F3)
2. Give any criteria ( status == Invoiced) and click on modify -->Save as Cue
 3. Save the Cue by assigning Cue Id as "Total_POInvoiced" , Security profile(who all can use)

4. Created Cue can be viewed in Basic-->Setup->RoleCenter->Edit Cues.



5. In order to deploy , Edit Role center homepage
             a. Click on Add new webPart and select Cues Web Part.
             b. Click on modify webpart and select above created Cue "Total_POInvoiced" in    
                 property      sheet .
             c. Click on Apply and Ok .
             d. When you exit edit mode , you will see total number of pending Invoices as image .

6. If you click on Cue "Total Invoiced PO " on Rolecenter you will be navigated to form which will show only invoiced purchase orders.

Technically :
When you create Cue , record gets created in CuesQuery Table with Formname , menuItemName and Query created from user criterias.
So when user click on Cue , It will take you to Form from where you created Cue by using the value from menuItemname.

Following X++ Job Creates Cue for customer form.

static void DEV_createCue(Args _args)
{
    CuesQuery       cuesQuery;
    Query           query = new Query(querystr(Cust));
    ;

    cuesQuery.clear();

    cuesQuery.CueId         = "TST_CustQuery2";
    cuesQuery.Caption       = "Cue test for CustTable";
    cuesQuery.CueVersion    = 1;
    cuesQuery.CreatorUserId = curUserid();
    cuesQuery.FormName      = "CustTable";
    cuesQuery.DataSourceName = "CustTable";
    cuesQuery.Query = query.pack();
    cuesQuery.ClientMenuItemName = "CustTable";
    cuesQuery.CueMin = 1;
    cuesQuery.CueMax = 10;
    cuesQuery.Threshold = 0;
    cuesQuery.ThresholdCriteria = CuesThresholdCriteria::None;
    cuesQuery.SecurityAccessFlag = CuesSecurityFlag::SpecifiedProfiles;
    cuesQuery.AdditionalValFunc = CuesAdditionalValFunc::None;
    cuesQuery.AdditionalValField = " ";
    cuesQuery.AdditionalValTable = " ";

    if (cuesQuery.validateWrite())
    {
        cuesQuery.insert();
        info(strfmt("Cue %1 Created with SecurityRights as %2",cuesQuery.CueId,cuesQuery.SecurityAccessFlag));
    }
}

Cool....

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.