Thursday 27 March 2014

Tech Tip Thursday: Variables in E-Mail Message Query Strings

Using Variables in an E-Mail Message Query String is an advanced way to build custom email messages. Since you can pull any data from any item within Aras and utilize it as part of a mail merge, building these custom queries is as simple as knowing what data you want to pull, the standard text you'd like to use around the data, and some AML to get your messages on the move.

Example messages might be for purchase requests tied to the BOM including a list of items with cost and current status or an engineering change review that you want to send with an attached problem report. Really the possibilities are endless. If it's in Innovator, you can make it happen.

Since so many developers want to be able to build these kinds of custom email messages with data that lives in Aras Innovator; here's the example for you:

Using variables in an E-Mail Message Query String

This example shows how to use parameters in an E-Mail Message Query String to populate variables in both the body of the message as well as the subject line when the message is generated.

For this example, an ECR is created from the PE Solution database and a PR (Problem Report) is attached to the ECR. The body of the letter when sent from a workflow notification will indicate the attached PR number and title.

To use the parameters in the Query String of the E-Mail Message requires some knowledge of XPath as well as the XSLT language which are assumed in this example. You should also have a working knowledge of the Aras AML language to retrieve the information shown.

In order to access the item_number and title properties of the PR item requires retrieving the ECR PR relationship for the current ECR. This can be done using the following Query String statement:

${Item/@id}


Notice that the source_id value for the relationship lookup has been specified using an XSLT parameter. Substitution parameters must be enclosed in $ { } . Since this E-Mail Message will be associated with an ECR, the expression Item/@id will be substituted with the id of the current ECR being processed.

The AML statement will locate the relationship associated with the current ECR and then retrieve the related PR item.
To access properties of the PR item in the email message requires locating the values in the retrieved XML. The following example shows how to display the item_number and title of the PR in the E-mail Message body:
Please review ECR with the following PR attached:
PR # : ${Item[@type="ECR PR"]/related_id/Item[@type="PR"]/item_number}
Title: ${Item[@type="ECR PR"]/related_id/Item[@type="PR"]/title}

The Query String also supports multiple queries that are performed in sequence when the e-mail message is generated. The following query retrieves the current ECR and the item_number from the database:

select="item_number"/>

To access the item number in the e-mail message (or subject line) use a variable:

Please Review ECR ${Item[@type="ECR"]/item_number}

So the complete e-mail message Query String will appear as:

select="item_number"/>

${Item/@id}


And the message body will appear as:

Please Review ECR ${Item[@type="ECR"]/item_number}

Attached PR is:

PR # : ${Item[@type="ECR PR"]/related_id/Item[@type="PR"]/item_number}
Title: ${Item[@type="ECR PR"]/related_id/Item[@type="PR"]/title}

For other examples of using XLST parameters in an E-mail message see the CM Activity Notification item in the solutions database.

Have an idea for a future Tech Tip? Let us know info@aras.com.

Source: http://www.aras.com



Tuesday 25 March 2014

Exposing Variables in Solid Edge and its Applications

The variable table in Solid Edge displays, defines, and manipulates design variables and functional relationships between the variables. The variable table can also be looked upon as a window for the outside world into a document and this is especially facilitated by the Expose feature.

Beginning V16, the variable table sported a new column called Expose. For those who use the Solid Edge API could access the variable names and values programmatically even without the Expose functionality. This post shows how to expose variables and about the various scenarios where this feature could be used by an end user who is not necessarily a programmer.

Expose a Variable

Create a simple box by extruding a dimensioned rectangle, then select Variables from the Variables Panel on the Tools tab. The variable table will be seen containing at least three dimension variables. Rename them appropriately as Length, Width and Height.

Observe the column - Expose - with only check boxes in it.

Note: You can re-order the columns by dragging the header and dropping it ahead or after any other column.

Click in the check boxes for all three variables and make sure they are checked ON.

By clicking in the check boxes, you have exposed the variables to the world outside this part.












 


File Properties

Once the variables are exposed, they are listed in the Document's properties.

Click the Solid Edge Application Button > Properties > File Properties and take the Custom tab. You will find that the three exposed variables are listed as Text type.















Callout in the Draft

These figures can also be pulled into a draft file in a Callout callout.jpg

In the Callout dialog, click the Property Text button pt.jpg

In the Select Property Text dialog, click Named reference from the drop down list.















You will find the exposed variables listed in the Properties list below.
The callout text would appear something as below:

%{Length/CP|AHU_KA700.par} x %{Width/CP|AHU_KA700.par} x %{Height/CP|AHU_KA700.par}

The variable name is tightly coupled to the file name in the text indicating the values in the callout text will always update since they have reference to the part file.

Applications in Assembly

Recently I was contacted by a AHU (Air Handling Unit) designer who would create assemblies out of only boxes of various sizes which represent the place holders of the various components inside an AHU.

The assembly was required to reflect the quantity and sizes of the boxes to appear in the BOM. Neither of these was a problem with Expose Variables.










The Parts List in Draft environment also supports exposed variables.
In the Parts List properties dialog, take the Columns tab. In the Properties list, select the Length, Width, Height items and click Add Column to add the exposed variables to the Parts List column. This would result in a Parts List as shown in image above.

Adding a column for a user-defined variable such as the space taken up by the components of the boxes is just as easy. Back to the part document and inside the variable table, add a new variable called BoxVolume and specify "= Length * Width * Height" as the formula without the quotes. Not to mention, Expose the variable to be able to add it to the Callout or Parts List or have it listed as a Custom property.


Source: www.plm.automation.siemens.com