upload
upload, tile type
The upload tile is intended to facilitate the upload of typically smaller files directly from an Envision dashboard, without navigating back and forth to the Files area in your Lokad account. When considering complex simulators that involve many parameters, it is often simpler to have all those parameters gathered in a spreadsheet, as opposed to entering all those values within a web page. While it is possible to upload such a spreadsheet like any other file in your Lokad account, it is more practical if the upload can happen directly within the dashboard. The upload tile is precisely intended to support this use case.
read upload "customsuppliers" as MySuppliers with
SupplierId : text
SupplierQuota : number
SupplierCountry : text
show upload "Supplier settings" a1d3 editable:"customsuppliers"
Unlike other tiles, the upload tile is tightly coupled with a corresponding read upload statement by means of a shared identifier (in the above example, "customsuppliers" is the shared identifier). Indeed, the syntax offers a way to treat the data uploaded by the user, just like any other table also accessible to Envision. The syntax lets you specify the expected format for the table columns to be uploaded within the dashboard. Also, just like any other data inputs, Envision provides a complete versioning of the uploaded files previously processed. The previously uploaded files can be re-downloaded from the History link of the dashboard.
Uploads come from dashboard submissions. Runs from the IDE or RunFlow replay the last submission unless overridden there. The last submission is not a programmatic state.
This upload feature is accessible to any user who has access to the dashboard, without requiring the user to have access to the file storage area of your Lokad account. Thus the upload tile is also handy to provide more granular user accesses.
Initial file selection
Without a with clause, the tile displays the upload used by the current run
for its editable: identifier, or an empty selection if there was none.
To override that selection, provide exactly two scalar text values after
with, in this order: the file hash and the filename.
To produce an empty tile even when the current run used an uploaded file, provide two empty strings:
read upload "customsuppliers" as MySuppliers with
SupplierId : text
SupplierQuota : number
SupplierCountry : text
show upload "Supplier settings" a1d3 editable:"customsuppliers" with
""
""
Submitting this dashboard without selecting another file clears the previous
upload for "customsuppliers"; the next run does not reuse that file. The
empty selection does not change the data already read by the current run.
Conversely, provide a nonempty file hash and filename to initialize the tile with an existing file. In the following variant, replace the illustrative hash with the actual hash of an uploaded file available to the account, and use its filename:
read upload "customsuppliers" as MySuppliers with
SupplierId : text
SupplierQuota : number
SupplierCountry : text
hash = "0123456789ABCDEF0123456789ABCDEF" // Replace with an actual file hash
name = "suppliers.tsv"
show upload "Supplier settings" a1d3 editable:"customsuppliers" with
hash
name
The tile starts with that file selected. Unless the user replaces or clears
it, the next dashboard submission supplies it to the matching read upload.
This syntax references existing file contents; it does not upload a new file
or replace the input already read by the current run.
The hash must be a valid file hash, not a filesystem path or a value produced
by Envision’s hash function. A nonempty hash requires a nonempty filename.
The filename must not contain a directory path, for example suppliers.tsv
rather than /settings/suppliers.tsv.
StyleCode
For generic StyleCode rules, see stylecode.