+ Start a Discussion
sevindusevindu 

einstein analytics data preparation specialist super badge

Please help me on this step 
User-added image

1. .Dataflow Name: Load Seed Bank Agencies w/Climate Data

User-added image
{
  "Add Temp Class": {
    "action": "computeExpression",
    "parameters": {
      "source": "Filter 2015",
      "mergeWithSource": true,
      "computedFields": [
        {
          "defaultValue": "\"Continental\"",
          "name": "TempClass",
          "saqlExpression": "case\nwhen Temperature > 85 then \"Tropical\"\nwhen Temperature >= 51 && Temperature <=85 then \"Continental\"\nwhen Temperature >=25 && Temperature <=50 then \"Cool\"\nelse \"Polar\"\nend",
          "label": "TempClass",
          "type": "Text"
        }
      ]
    }
  },
  "Filter Agency Records": {
    "action": "filter",
    "parameters": {
      "filter": "IsAgency:EQ:TRUE",
      "source": "ID Agency Records"
    }
  },
  "Load Account": {
    "action": "sfdcDigest",
    "parameters": {
      "fields": [
        {
          "name": "AccountNumber"
        },
        {
          "name": "Name"
        },
        {
          "name": "Phone"
        },
        {
          "name": "ShippingCity"
        },
        {
          "name": "ShippingCountry"
        },
        {
          "name": "ShippingState"
        },
        {
          "name": "ShippingStreet"
        },
        {
          "name": "ShippingPostalCode"
        }
      ],
      "object": "Account"
    }
  },
  "Create Seed Bank Agencies": {
    "action": "sfdcRegister",
    "parameters": {
      "name": "Create Seed Bank Agencies",
      "alias": "Create_Seed_Bank_Agencies",
      "source": "Augment TempClass"
    }
  },
  "Load Climate": {
    "action": "edgemart",
    "parameters": {
      "alias": "Global_Climates"
    }
  },
  "Add Agency Fields": {
    "action": "augment",
    "parameters": {
      "right_key": [
        "AccountNumber"
      ],
      "left": "Load Account",
      "left_key": [
        "AccountNumber"
      ],
      "right_select": [
        "Currency",
        "Acres",
        "Latitude",
        "Longitude",
        "SubRegion"
      ],
      "right": "Load Agency Detail",
      "relationship": "AgencyDetail",
      "operation": "LookupSingleValue"
    }
  },
  "Filter 2015": {
    "action": "filter",
    "parameters": {
      "filter": "Date_Year:EQ:2015",
      "source": "Load Climate"
    }
  },
  "Augment TempClass": {
    "action": "augment",
    "parameters": {
      "right_key": [
        "ShippingCountry"
      ],
      "left": "Add Temp Class",
      "left_key": [
        "Country"
      ],
      "right_select": [
        "AccountNumber",
        "AgencyDetail.Acres",
        "AgencyDetail.Currency",
        "AgencyDetail.Latitude",
        "AgencyDetail.Longitude",
        "AgencyDetail.SubRegion",
        "IsAgency",
        "Name",
        "Phone",
        "ShippingCity",
        "ShippingPostalCode",
        "ShippingCountry",
        "ShippingState",
        "ShippingStreet"
      ],
      "right": "Filter Agency Records",
      "relationship": "Climate",
      "operation": "LookupSingleValue"
    }
  },
  "Load Agency Detail": {
    "action": "edgemart",
    "parameters": {
      "alias": "Agency_Detail"
    }
  },
  "ID Agency Records": {
    "action": "computeExpression",
    "parameters": {
      "source": "Add Agency Fields",
      "mergeWithSource": true,
      "computedFields": [
        {
          "name": "IsAgency",
          "saqlExpression": "case when Phone  is not null then \"TRUE\" else \"FALSE\" end",
          "label": "IsAgency",
          "type": "Text"
        }
      ]
    }
  }
}
Close
Search nodes...
hidden

2. New Dataflow Name - Load Seed Bank w/Temperature Classification

User-added image
{
  "Add Temp Class": {
    "action": "computeExpression",
    "parameters": {
      "source": "Define Temp Range",
      "mergeWithSource": true,
      "computedFields": [
        {
          "name": "TempKey",
          "saqlExpression": "case \nwhen LowTemp < 25 and HighTemp < 25 then \"Polar\" \nwhen LowTemp >= 25 and LowTemp <= 50 and HighTemp >= 25 and HighTemp <= 50 then \"Cool\"\nwhen LowTemp >= 51 and LowTemp <= 85 and HighTemp >= 51 and HighTemp <= 85 then \"Continental\"\nwhen LowTemp > 85 and HighTemp > 85 then \"Tropical\"\nwhen LowTemp < 25 and (HighTemp >= 25 and HighTemp <= 50) then \"Polar-Cool\" \nwhen LowTemp < 25 and (HighTemp >= 25 and HighTemp <= 85) then \"Polar-Cool-Continental\" \nwhen LowTemp < 25 and HighTemp > 85 then \"Polar-Cool-Continental-Tropical\" \nwhen (LowTemp >= 25 and LowTemp <= 50) and (HighTemp >= 51 and HighTemp <= 85) then \"Cool-Continental\" \nwhen (LowTemp >= 25 and LowTemp <= 50) and HighTemp >= 85 then \"Cool-Continental-Tropical\" \nwhen (LowTemp >= 51 and LowTemp <= 85) and HighTemp > 85 then \"Continental-Tropical\" \nend",
          "label": "TempKey",
          "type": "Text"
        }
      ]
    }
  },
  "Calculate Acreage": {
    "action": "computeExpression",
    "parameters": {
      "source": "Load Seed Chart",
      "mergeWithSource": true,
      "computedFields": [
        {
          "precision": 18,
          "name": "Acreage",
          "saqlExpression": "(Seeds_Pound*Spacing)/6272640",
          "scale": 6,
          "label": "Acreage",
          "type": "Numeric"
        }
      ]
    }
  },
  "Create Seed Bank": {
    "action": "sfdcRegister",
    "parameters": {
      "name": "Create Seed Bank",
      "alias": "Create_Seed_Bank",
      "source": "CleanUp"
    }
  },
  "Load Seed Chart": {
    "action": "edgemart",
    "parameters": {
      "alias": "Seed_Chart"
    }
  },
  "Augment Temp Class": {
    "action": "augment",
    "parameters": {
      "right_key": [
        "TempKey"
      ],
      "left": "Load Temp Class Mapping",
      "left_key": [
        "TempClass"
      ],
      "right_select": [
        "Temperature",
        "Seed_ID",
        "Seed",
        "Lifecycle",
        "Seed_Type",
        "Quantity_Pounds",
        "Seeds_Pound",
        "Spacing",
        "Acreage",
        "TempKey"
      ],
      "right": "Add Temp Class",
      "relationship": "Climate",
      "operation": "LookupSingleValue"
    }
  },
  "Load Temp Class Mapping": {
    "action": "edgemart",
    "parameters": {
      "alias": "Temperature_Classes_Mapping"
    }
  },
  "CleanUp": {
    "action": "sliceDataset",
    "parameters": {
      "mode": "drop",
      "source": "Augment Temp Class",
      "fields": [
        {
          "name": "TempClass"
        },
        {
          "name": "TempKey"
        }
      ]
    }
  },
  "Define Temp Range": {
    "action": "computeExpression",
    "parameters": {
      "source": "Calculate Acreage",
      "mergeWithSource": true,
      "computedFields": [
        {
          "defaultValue": "0",
          "precision": 18,
          "name": "HighTemp",
          "saqlExpression": "string_to_number(substr(Temperature,4,5))",
          "scale": 2,
          "label": "HighTemp",
          "type": "Numeric"
        },
        {
          "defaultValue": "0",
          "precision": 18,
          "name": "LowTemp",
          "saqlExpression": "string_to_number(substr(Temperature,1,2))",
          "scale": 2,
          "label": "LowTemp",
          "type": "Numeric"
        }
      ]
    }
  }
}
Close
Search nodes...
hidden

​​​​​​​