More prettifiations
This commit is contained in:
parent
7ff6ff73fa
commit
04944b1584
3 changed files with 62 additions and 77 deletions
|
|
@ -51,67 +51,44 @@ Code example (Insert a record, apply a template, and insert the related template
|
|||
|
||||
**// Apply a template RecRef.GETTABLE(Customer);**
|
||||
|
||||
```al
|
||||
ConfigTemplateMgt.UpdateRecord(ConfigTemplateHeader,RecRef);
|
||||
|
||||
RecRef.SETTABLE(Customer);
|
||||
```
|
||||
|
||||
**// Insert Dimensions -- related templates**
|
||||
|
||||
```al
|
||||
MiniDimensionsTemplate.InsertDimensionsFromTemplates(ConfigTemplateHeader,Customer."No.",DATABASE::Customer);
|
||||
|
||||
```
|
||||
Code to insert related templates (dimensions):
|
||||
|
||||
**FUNCTION InsertDimensionsFromTemplates(ConfigTemplateHeader : Record "Config. Template Header";MasterRecordNo : Code\[20\];TableID : Integer)**
|
||||
|
||||
**// There are multiple records (multiple dimensions per master record)**
|
||||
|
||||
**// We have to set filter******
|
||||
|
||||
ConfigTemplateLine.SETRANGE(Type,ConfigTemplateLine.Type::"Related Template");****
|
||||
|
||||
ConfigTemplateLine.SETRANGE("Data Template Code",ConfigTemplateHeader.Code);****
|
||||
|
||||
****
|
||||
|
||||
IF ConfigTemplateLine.FINDSET THEN****
|
||||
|
||||
REPEAT****
|
||||
|
||||
ConfigTemplateHeader.GET(ConfigTemplateLine."Template Code");
|
||||
|
||||
**// Ensure that the table where the template belongs to is Dimensions**
|
||||
|
||||
**// We could have other related templates******
|
||||
|
||||
IF ConfigTemplateHeader."Table ID" = DATABASE::"Default Dimension" THEN****
|
||||
|
||||
InsertDimensionFromTemplate(ConfigTemplateHeader,MasterRecordNo,TableID);****
|
||||
|
||||
UNTIL ConfigTemplateLine.NEXT = 0;****
|
||||
|
||||
****
|
||||
```al
|
||||
FUNCTION InsertDimensionsFromTemplates(ConfigTemplateHeader : Record "Config. Template Header";MasterRecordNo : Code\[20\];TableID : Integer)
|
||||
// There are multiple records (multiple dimensions per master record)
|
||||
// We have to set filter
|
||||
ConfigTemplateLine.SETRANGE(Type,ConfigTemplateLine.Type::"Related Template");
|
||||
ConfigTemplateLine.SETRANGE("Data Template Code",ConfigTemplateHeader.Code
|
||||
IF ConfigTemplateLine.FINDSET THEN
|
||||
REPEAT
|
||||
ConfigTemplateHeader.GET(ConfigTemplateLine."Template Code");
|
||||
// Ensure that the table where the template belongs to is Dimensions
|
||||
// We could have other related templates
|
||||
IF ConfigTemplateHeader."Table ID" = DATABASE::"Default Dimension" THEN
|
||||
InsertDimensionFromTemplate(ConfigTemplateHeader,MasterRecordNo,TableID);
|
||||
UNTIL ConfigTemplateLine.NEXT = 0;
|
||||
```
|
||||
|
||||
**// Create a new Dimensions Record and link it to the Master Record******
|
||||
|
||||
**FUNCTION InsertDimensionFromTemplate(ConfigTemplateHeader : Record "Config. Template Header";MasterRecordNo : Code\[20\];TableID : Integer)**
|
||||
|
||||
DefaultDimension.INIT;
|
||||
|
||||
DefaultDimension."No." := MasterRecordNo;****
|
||||
|
||||
DefaultDimension."Table ID" := TableID;****
|
||||
|
||||
DefaultDimension."Dimension Code" := GetDefaultDimensionCode(ConfigTemplateHeader);****
|
||||
|
||||
DefaultDimension.INSERT;****
|
||||
|
||||
****
|
||||
|
||||
RecRef.GETTABLE(DefaultDimension);****
|
||||
|
||||
ConfigTemplateMgt.UpdateRecord(ConfigTemplateHeader,RecRef);****
|
||||
|
||||
RecRef.SETTABLE(DefaultDimension);
|
||||
```al
|
||||
FUNCTION InsertDimensionFromTemplate(ConfigTemplateHeader : Record "Config. Template Header";MasterRecordNo : Code\[20\];TableID : Integer)
|
||||
DefaultDimension.INIT;
|
||||
DefaultDimension."No." := MasterRecordNo;
|
||||
DefaultDimension."Table ID" := TableID;
|
||||
DefaultDimension."Dimension Code" := GetDefaultDimensionCode(ConfigTemplateHeader);
|
||||
DefaultDimension.INSERT;
|
||||
RecRef.GETTABLE(DefaultDimension);
|
||||
ConfigTemplateMgt.UpdateRecord(ConfigTemplateHeader,RecRef);
|
||||
RecRef.SETTABLE(DefaultDimension);
|
||||
```
|
||||
|
||||
**To surface the action in the product, you have three options:**
|
||||
|
||||
|
|
@ -119,7 +96,7 @@ RecRef.SETTABLE(DefaultDimension);
|
|||
2. **Optional** - Implement the apply template function on the document itself. This is especially good in scenarios where users are allowed to change the template.
|
||||
3. **Alternative** - Remove the new action by configuration or set Insert Allowed to FALSE on the list (this will block the creation of new records from the lookup). Implement an application action named **New** and tie it to your code.
|
||||
|
||||
**Note: ** In Microsoft Dynamics C5 2014, we chose to remove the **New** action with configuration since we wanted to promote the functionality and avoid the confusion in having too many options. However this might be difficult to maintain with a larger set of pages.
|
||||
**Note:** In Microsoft Dynamics C5 2014, we chose to remove the **New** action with configuration since we wanted to promote the functionality and avoid the confusion in having too many options. However this might be difficult to maintain with a larger set of pages.
|
||||
|
||||
**To view or edit templates, you have two options:**
|
||||
|
||||
|
|
@ -167,7 +144,9 @@ The user opens the **Customers List** window and selects **New**
|
|||
|
||||
**[![ ][image3]][anchor3]**
|
||||
|
||||
**[][anchor3]**From this page, the user can view the template, edit it, or create a new one. Selecting a template will populate the customer card and open a new record. From the existing record, the user has options to save as a template or opening a list of templates to maintain available templates. Selecting a template will populate the customer card and open a new record. From the existing record, the user has options to save as a template or opening a list of templates to maintain available templates.
|
||||
**[][anchor3]**
|
||||
|
||||
From this page, the user can view the template, edit it, or create a new one. Selecting a template will populate the customer card and open a new record. From the existing record, the user has options to save as a template or opening a list of templates to maintain available templates. Selecting a template will populate the customer card and open a new record. From the existing record, the user has options to save as a template or opening a list of templates to maintain available templates.
|
||||
|
||||
[![ ][image4]][anchor4]
|
||||
|
||||
|
|
@ -180,14 +159,14 @@ From the **Customer Card Template **window, we can invoke the **Dimensions** act
|
|||
This pattern is used in Microsoft Dynamics C5 2014 in the following objects:
|
||||
|
||||
* Temporary template tables:
|
||||
* **Mini Customer Template **table (1300)
|
||||
* **Mini Item Template **table (1301)
|
||||
* **Mini Customer Template** table (1300)
|
||||
* **Mini Item Template** table (1301)
|
||||
* **Mini Dimensions Template** table(1302)
|
||||
* **Mini Vendor Template** table (1303)
|
||||
|
||||
* Pages to define templates:
|
||||
* **Mini Customer Template Card** page (1341)
|
||||
* **Mini Item Template Card **page (,1342)
|
||||
* **Mini Item Template Card** page (,1342)
|
||||
* **Mini Dimensions Template List** page (1343)
|
||||
* **Mini Vendor Template Card** page (1344)
|
||||
|
||||
|
|
|
|||
|
|
@ -38,9 +38,11 @@ Where:
|
|||
* **Object Type** and **Object ID** define the type of the application object to run (Table, Page, Report, Codeunit, Query, or XMLport) and its ID.
|
||||
* **Record** specifies the actual data to run the URL on, such as:
|
||||
|
||||
```al
|
||||
Vendor.GET("Account No.");
|
||||
|
||||
GETURL(CLIENTTYPE:WEB,COMPANYNAME, OBJECTTYPE::Page,27,Vendor)
|
||||
```
|
||||
|
||||
**Note**: It is currently not possible to set filters on the record that you sent as a last parameter to the GETURL function. However, it is possible to write your own code to compute and append the filter string to the URL that is created by the GETURL function.
|
||||
|
||||
|
|
@ -61,7 +63,7 @@ The following are examples of calls to GETURL and their corresponding return val
|
|||
**Command**
|
||||
|
||||
**URL**
|
||||
|
||||
```al
|
||||
GETURL(CLIENTTYPE::Win)
|
||||
|
||||
dynamicsnav://MyServer:7046/DynamicsNAV71//
|
||||
|
|
@ -202,12 +204,15 @@ GETURL(CLIENTTYPE::Web,COMPANYNAME,OBJECTTYPE::Report,6)
|
|||
|
||||
https://navwebsrvr:443/DynamicsNAV71\_Instance1/Webclient?company=CRONUS&report=6
|
||||
|
||||
```
|
||||
|
||||
If the GETURL function is called with invalid parameters, it will return an empty string. In that case, you can find the related error text by calling the GETLASTERRORTEXT function.
|
||||
|
||||
**Function Call**
|
||||
|
||||
**Error Message**
|
||||
|
||||
```al
|
||||
GETURL(CLIENTTYPE::Web,COMPANYNAME,OBJECTTYPE::Table,27)
|
||||
|
||||
The specified object type parameter for the GetUrl function is not valid.
|
||||
|
|
@ -274,6 +279,8 @@ The specified object type parameter for the GetUrl function is not valid.
|
|||
|
||||
GETURL(CLIENTTYPE::SOAP,COMPANYNAME,OBJECTTYPE::Page,27,record)
|
||||
|
||||
```
|
||||
|
||||
You cannot specify a record parameter for the GetUrl function when the object type is SOAP
|
||||
|
||||
## NAV Specific Example
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ The most commonly used actions are:
|
|||
* **Set Period**, **Work Date**
|
||||
* Actions to filter the data set
|
||||
* **Refresh**
|
||||
* **Chart Information **-- a tooltip with a description of the chart and how data is calculated.
|
||||
* **Chart Information** -- a tooltip with a description of the chart and how data is calculated.
|
||||
|
||||
### Optional: Preserving User Personalization
|
||||
|
||||
|
|
@ -96,33 +96,32 @@ If you need a setup record and codeunit, then it is a good idea to encapsulate t
|
|||
|
||||
Implementation of the **Finance Performance Chart** page (762)
|
||||
|
||||
**BusinessChart::AddInReady()**
|
||||
```al
|
||||
BusinessChart::AddInReady()
|
||||
UpdateChart(Period::" ");
|
||||
|
||||
UpdateChart(Period::" ");
|
||||
LOCAL UpdateChart(Period : ',Next,Previous')
|
||||
MoveAndUpdateChart(Period,0);
|
||||
|
||||
**LOCAL UpdateChart(Period : ',Next,Previous')**
|
||||
LOCAL MoveAndUpdateChart(Period : ',Next,Previous';Move : Integer)
|
||||
AccSchedChartManagement.GetSetupRecordset(AccountSchedulesChartSetup,AccountSchedulesChartSetup.Name,Move);
|
||||
|
||||
MoveAndUpdateChart(Period,0);
|
||||
AccSchedChartManagement.UpdateData(Rec,Period,AccountSchedulesChartSetup);
|
||||
|
||||
**LOCAL MoveAndUpdateChart(Period : ',Next,Previous';Move : Integer)**
|
||||
Update(CurrPage.BusinessChart);
|
||||
|
||||
AccSchedChartManagement.GetSetupRecordset(AccountSchedulesChartSetup,AccountSchedulesChartSetup.Name,Move);
|
||||
|
||||
AccSchedChartManagement.UpdateData(Rec,Period,AccountSchedulesChartSetup);
|
||||
|
||||
Update(CurrPage.BusinessChart);
|
||||
|
||||
StatusText := GetCurrentSelectionText("Period Filter Start Date","Period Filter End Date");
|
||||
StatusText := GetCurrentSelectionText("Period Filter Start Date","Period Filter End Date");
|
||||
```
|
||||
|
||||
In the MoveAndUpdateChart method, the AccSchedChartManagement codeunit gets a setup record and updates it if necessary. Then, it initializes the chart with setup data and sets the StatusText to show the period for which data is displayed. The same method is used by the actions to move and update the chart so that there is no code duplication.
|
||||
|
||||
The following code is used to implement **DataPointClicked**
|
||||
|
||||
******BusinessChart::DataPointClicked(point : DotNet "Microsoft.Dynamics.Nav.Client.BusinessChart.BusinessChartDataPoint")**
|
||||
|
||||
SetDrillDownIndexes(point);
|
||||
|
||||
AccSchedChartManagement.DrillDown(Rec,AccountSchedulesChartSetup);
|
||||
```al
|
||||
BusinessChart::DataPointClicked(point : DotNet "Microsoft.Dynamics.Nav.Client.BusinessChart.BusinessChartDataPoint")
|
||||
SetDrillDownIndexes(point);
|
||||
AccSchedChartManagement.DrillDown(Rec,AccountSchedulesChartSetup);
|
||||
```
|
||||
|
||||
SetDrillDownindexes is a method from the **Business Chart Buffer** table that maps the DotNet point variable to C/AL data, so it must be used. The next method that you must implement is the action to be performed on Drilldown.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue