Salesforce
Upload to Analytics from a variable
Overview
This BLOCK uploads data stored in a variable to an Einstein Analytics dataset. Metadata for the data to be uploaded should also be included.
Prepare your data as an array of objects. See the Data format section for details.
The Execute query BLOCK (BigQuery category) returns query results in a variable with this data format. As such, you don’t need to worry about the data’s formatting if simply upload query results from an Execute query BLOCK.
You should also include JSON format metadata for the structure of the data to be uploaded.
For example, take the following image and JSON metadata. To upload the data in the image, you would create metadata like that shown below notating the formatting, data format, etc., for name
, amount
, and close_date
. Refer to Analytics External Data Format Reference open_in_new for more details on creating metadata.
{ "fileFormat": { "charsetName": "UTF-8", "fieldsEnclosedBy": "\"", "fieldsDelimitedBy": ",", "numberOfLinesToIgnore": 1 }, "objects": [ { "connector": "AcmeCSVConnector", "description": "", "fullyQualifiedName": "SalesData", "label": "Sales Data", "name": "SalesData", "fields": [ { "description": "", "fullyQualifiedName": "SalesData.Name", "label": "Account Name", "name": "name", "isSystemField": false, "isUniqueId": false, "isMultiValue": false, "type": "Text" }, { "description": "", "fullyQualifiedName": "SalesData.Amount", "label": "Opportunity Amount", "name": "amount", "isSystemField": false, "defaultValue": "0", "isUniqueId": false, "type": "Numeric", "precision": 10, "scale": 2, "format": "$#,##0.00" }, { "description": "", "fullyQualifiedName": "SalesData.CloseDate", "label": "Opportunity Close Date", "name": "close_date", "isSystemField": false, "isUniqueId": false, "type": "Date", "format": "yyyy-MM-dd", "fiscalMonthOffset": 0 } ] } ] }
info_outline Although it is possible to leave the Metadata JSON property blank, we recommend setting it. When left blank, all data is handled as text only.
Data format
As mentioned previously, you should prepare the data to be uploaded as an array of objects.
info_outline You do not need to worry about this formatting when directly uploading query results from the Execute query BLOCK. Refer to this section when preparing data from another source.
We will use the following image of sales data to explain how to prepare your data for uploading.
Create an object for each record (row), then combine them into an array.
An object contains data as multiple key and value pairs.
You can create an array of objects using the Construct object BLOCK from the Basic category. Set objects by selecting the Object type and arrays by selecting the Array type.
If you want to pass data to the Flow from an external application, prepare your data in JSON format.
[ { "name": "opportunityA", "amount": 100.99, "sales_date": "2014-06-30" }, { "name": "opportunityB", "amount": 99.01, "sales_date": "2012-01-31" } ]
Properties
Property | Explanation |
---|---|
BLOCK name | Configure the name displayed on this BLOCK. |
Account |
Select a Salesforce account. info_outline You must register a Salesforce account into the Salesforce accounts section of the settings menu beforehand. |
Source data variable | Designate the variable containing the data to be uploaded to an Einstein Analytics Dataset. |
Dataset | Designate the Einstein Analytics Dataset to which data will be uploaded. |
Metadata JSON |
Designate JSON format metadata for the structure of the data to be uploaded. See Analytics External Data Format Reference for details on creating metadata. |
Sandbox | Designate whether or not the upload destination is a Salesforce Sandbox environment. |
BLOCK memos | Make notes about this BLOCK. |
Operation |
Select the operation to use when loading data into the dataset.
info_outline Metadata is required to use the append, upsert, and delete operations.
|