Asset Push File Name Scenario

A calculated attribute can be used to create a custom file name for use with assets exported from STEP using the Asset Push functionality.

In this scenario, the file name of assets will be generated to contain the ID of the asset, appended with the date and timestamp of the upload. Of course, other attribute values may be included in the file name generation, including (but not limited to) Description Attributes values on the asset and any other attribute value from the asset's System Attribute flipper.

For information on Asset Push, refer to the Asset Push topic in the Digital Assets documentation here.

Assumptions

  1. An asset push attribute macro key with the Attribute Key value 'filename' is created to hold the calculated attribute 'CalcFileName1(CalcFileName1)'. A macro key attribute must be a description attribute. For more information on this macro, refer to Asset Push Attribute Macro Keys topic within the Users and Groups section of the System Setup documentation here.

  1. The Asset Push Configuration 'Web85x85' will use the 'filename' macro key within its Relative Path Template, in order to construct the full path and file name of the assets pushed with this configuration. For details on creating a Relative Path Template, refer to the Relative Path Template documentation here.

  1. In this scenario, the asset being pushed is '0227658 11CC(0227658-11CC)' and the following screenshot includes some of the available description attribute values. In the Asset editor, the metadata system default attribute 'Upload Time(asset.uploaded)' is found under the System Properties flipper. The value of this asset is used to produce the date and time of the upload. The CalcFileName1 attribute displays the concatenation of the ID, upload date, and upload time, as described in the solution below.

Solution

Approach

A description calculated attribute 'CalcFileName1(CalcFileName1)' is made valid for all relevant assets, and includes two (2) variables:

  • The uploaddate variable extracts the date of the upload, for example 2017-06-06, removing the dash or hyphen (-) character. For purposes of this example, assume that the requirement is not to have any separators in the date value.
  • The uploadtime variable extracts the time of the upload, for example 14:53:28, removing the colon (:) character. Apart from the fact that this is an illegal character in a file name, again assume that the preference is not to use any separator in the time value.

Value Template

{uploaddate := substitute(left(value('asset.uploaded'), 10), "-", ""),
uploadtime := substitute(left(value('asset.uploaded'), 8), ":", "")
}
concatenate(stepid(), "_", uploaddate, "_", uploadtime)

Results

The pushed asset file is saved to the path generated by the Relative Path Template within the Asset Push Configuration, and includes the file name generated by the calculated attribute. The calculate attribute separates each of the elements of the file name listed below with an underscore (_):

  • STEP ID = 0227658-11CC
  • Upload date = 20150423
  • Upload time = 100752