Home > Software design >  Field not populating in JOLT
Field not populating in JOLT

Time:11-27

I have mapped a field userEmailid in JOLT but that field is not showing put in the output.

Main Snippet :

"WG_REQUESTOR_EMAIL": "integration-inbound:IntegrationDetails.integrationEntities.
integrationEntity.integrationEntityDetails.poDetails.items.item.requesterDetails.
userEmailId",

Input :

{
  "PURCHASE_ORDER_DISPATCH": {
    "MsgData": {
      "Transaction": {
        "PO_POD_HDR_EVW1": {
          "WG_ADDR_SEQ_NUM": 1,
          "WG_PO_CNTCT_EMAIL": "[email protected]",
          "WG_REQUESTOR_EMAIL": "[email protected]",
          "WG_REQ_FIRST_NAME": "Zachary",
          "WG_REQ_LAST_NAME": "Engels",
          "WG_DELIVER_TO": "[email protected]",
          "BUSINESS_UNIT": "OFIC",
          "PO_ID": 25052,
          "VENDOR_SETID": "WCOS",
          "VENDOR_ID": 35958,
          "VNDR_LOC": 1,
          "PO_DT": "2020-01-24",
          "DB_NUMBER_BU": "",
          "DESCR_BU": "OhioFarmersInsuranceCo",
          "ADDRESS1_BU": "WESTFIELDCOMPANIES",
          "ADDRESS2_BU": "HOMEOFFICE",
          "ADDRESS3_BU": "1PARKCIRCLE",
          "ADDRESS4_BU": "",
          "CITY_BU": "WESTFIELDCENTER",
          "STATE_BU": "OH",
          "POSTAL_BU": "44251-5001",
          "COUNTRY_BU": "USA",
          "ADDRESS1_BILL": "",
          "ADDRESS2_BILL": "",
          "ADDRESS3_BILL": "",
          "ADDRESS4_BILL": "",
          "CITY_BILL": "",
          "STATE_BILL": "",
          "POSTAL_BILL": "",
          "COUNTRY_BILL": "",
          "CURRENCY_CD": "USD",
          "TAX_EXEMPT_ID": "",
          "STD_ID_NUM_VNDR": "",
          "NAME1_VNDR": "AMAZONCAPITALSERVICESINC",
          "ADDRESS1_VNDR": "410TERRYAVEN",
          "ADDRESS2_VNDR": "",
          "ADDRESS3_VNDR": "",
          "ADDRESS4_VNDR": "",
          "CITY_VNDR": "SEATTLE",
          "STATE_VNDR": "WA",
          "POSTAL_VNDR": 98109,
          "COUNTRY_VNDR": "USA",
          "PYMNT_TERMS_CD": "NET30",
          "DESCR50_PAY": "Net30",
          "BUYER_ID": 1083,
          "PO_AMT_TTL": 14.99,
          "TEXT254_CC1": "",
          "TEXT254_CC2": "",
          "VNDR_UPN_FLG": "N",
          "STD_ID_NUM_VNDRGLN": "",
          "STD_ID_NUM_BILLTO": "",
          "ATTN_TO": "ZacharyEngels",
          "PO_POD_LN_EVW1": {
            "WG_REQ_ID": 25694,
            "WG_CATEGORY_CD": "FSSUP",
            "WG_ITEM_TYPE": 0,
            "WG_ACCOUNT": 641100,
            "WG_DEPT_ID": 30400,
            "WG_PRODUCT": "",
            "BUSINESS_UNIT": "OFIC",
            "PO_ID": 25052,
            "WG_ASSET_GROUP": "",
            "WG_CAPITALIZE": "NO",
            "WG_PROFILE_ID": "",
            "WG_SPLIT_TYPE": 1,
            "WG_ASSET_LOC": "HOME",
            "WG_PROJECT": "",
            "VENDOR_SETID": "WCOS",
            "VENDOR_ID": 35958,
            "VNDR_LOC": 1,
            "LINE_NBR": 1,
            "INV_ITEM_ID": "",
            "DESCR254_MIXED": "147-1518156-3620845,1GreenMountainCoffeeRoastersCaramelVanillaCreamKeurigSingle-ServeK-CupPods,LightRoastCoffee,32Count",
            "UNIT_OF_MEASURE": "EA",
            "ITM_ID_VNDR": "B0798CX2Q9",
            "INV_ITEM_WEIGHT": 0,
            "INV_ITEM_HEIGHT": 0,
            "INV_ITEM_VOLUME": 0,
            "INV_ITEM_LENGTH": 0,
            "INV_ITEM_WIDTH": 0,
            "VNDR_CATALOG_ID": "",
            "MFG_ID": "",
            "MFG_ITM_ID": 5000196305,
            "CNTRCT_ID": "",
            "VERSION_NBR": 0,
            "CNTRCT_LINE_NBR": 0,
            "CAT_LINE_NBR": 0,
            "RELEASE_NBR": 0,
            "CANCEL_STATUS": "A",
            "UPN_ID": "",
            "PO_POD_SHP_EVW1": {
              "WG_SHIP_ADDR_TYPE": 0,
              "WG_CUST_ADDR_CODE": "OFIC",
              "BUSINESS_UNIT": "OFIC",
              "PO_ID": 25052,
              "VENDOR_SETID": "WCOS",
              "VENDOR_ID": 35958,
              "VNDR_LOC": 1,
              "LINE_NBR": 1,
              "SCHED_NBR": 1,
              "DUE_DT": "2020-01-29",
              "SHIPTO_ID": "OFIC",
              "DESCR_SHIPTO": "OHIOFARMERSINSURANCECOMPANY",
              "ADDRESS1_SHIPTO": "OHIOFARMERSINSURANCECOMPANY",
              "ADDRESS2_SHIPTO": "1PARKCIRCLE",
              "ADDRESS3_SHIPTO": "POBOX5001",
              "ADDRESS4_SHIPTO": "",
              "CITY_SHIPTO": "WESTFIELDCENTER",
              "STATE_SHIPTO": "OH",
              "POSTAL_SHIPTO": "44251-5001",
              "COUNTRY_SHIPTO": "USA",
              "PRICE_PO": 14.99,
              "FREIGHT_TERMS": "FOBDEST",
              "QTY_PO": 1,
              "SHIP_TYPE_ID": "BEST_WAY",
              "CANCEL_STATUS": "A",
              "ATTN_TO": "",
              "STD_ID_NUM_SHIPTO": ""
            },
            "PSCAMA": {
              "AUDIT_ACTN": "A"
            }
          },
          "PSCAMA": {
            "AUDIT_ACTN": "A"
          }
        },
        "PSCAMA": {
          "LANGUAGE_CD": "ENG",
          "AUDIT_ACTN": "A",
          "BASE_LANGUAGE_CD": "ENG",
          "MSG_SEQ_FLG": "",
          "PROCESS_INSTANCE": 1199010,
          "PUBLISH_RULE_ID": "WG_MAIN_RULE",
          "MSGNODENAME": ""
        }
      }
    }
  }
}

JOLT Spec :

[
  {
    "operation": "shift",
    "spec": {
      "#UPSERT": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityHeader.action",
      "*": {
        "*": {
          "*": {
            "*": {
              "PO_ID": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.externalId",
              "#APPROVED": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.status",
              "PO_AMT_TTL": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.grossTotalAmount",
              "WG_REQUESTOR_EMAIL": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.requesterDetails.userEmailId",
              "*": {
                "WG_REQ_ID": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.poDescription",
                "#STANDARD": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.poType",
                "*": {
                  "FREIGHT_TERMS": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.deliveryTermCode"
                }
              }
            }
          }
        }
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "*": {
        "*": {
          "*": {
            "integrationEntityHeader": "&3.&2.&1.&",
            "integrationEntityDetails": {
              "*": {
                "externalId": "&5.&4.&3.&2.&1.&",
                "status": "&5.&4.&3.&2.&1.&",
                "poHeader": "&5.&4.&3.&2.&1.&"
              }
            }
          }
        }
      }
    }
  },
  {
    "operation": "cardinality",
    "spec": {
      "*": {
        "*": {
          "*": {
            "*": {
              "*": {
                "status": "ONE",
                "poHeader": {
                  "*": "ONE"
                }
              }
            }
          }
        }
      }
    }
  }
]

Output :

{
  "integration-inbound:IntegrationDetails": {
    "integrationEntities": {
      "integrationEntity": {
        "integrationEntityHeader": {
          "action": "UPSERT"
        },
        "integrationEntityDetails": {
          "poDetails": {
            "externalId": 25052,
            "status": "APPROVED",
            "poHeader": {
              "poType": "STANDARD",
              "grossTotalAmount": 14.99,
              "poDescription": 25694,
              "deliveryTermCode": "FOBDEST"
            }
          }
        }
      }
    }
  }
}

CodePudding user response:

You can use this spec:

[
  {
    "operation": "shift",
    "spec": {
      "#UPSERT": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityHeader.action",
      "*": {
        "*": {
          "*": {
            "*": {
              "PO_ID": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.externalId",
              "#APPROVED": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.status",
              "PO_AMT_TTL": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.grossTotalAmount",
              "WG_REQUESTOR_EMAIL": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.items.item.requesterDetails.userEmailId",
              "*": {
                "WG_REQ_ID": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.poDescription",
                "#STANDARD": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.poType",
                "*": {
                  "FREIGHT_TERMS": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.deliveryTermCode"
                }
              }
            }
          }
        }
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "*": {
        "*": {
          "*": {
            "integrationEntityHeader": "&3.&2.&1.&",
            "*": {
              "*": {
                "externalId": "&5.&4.&3.&2.&1.&",
                "status": "&5.&4.&3.&2.&1.&",
                "poHeader": "&5.&4.&3.&2.&1.&",
                "items": "&5.&4.&3.&2.&1.&"
              }
            }
          }
        }
      }
    }
  },
  {
    "operation": "cardinality",
    "spec": {
      "*": {
        "*": {
          "*": {
            "*": {
              "*": {
                "status": "ONE",
                "poHeader": {
                  "*": "ONE"
                }
              }
            }
          }
        }
      }
    }
  }
]

CodePudding user response:

You should convert the second shift transformation to this one

  {
    "operation": "shift",
    "spec": {
      "*": {
        "*": {
          "*": {
            "integrationEntityH*": "&3.&2.&1.&",
            "integrationEntityD*": {
              "*": {
                "*": "&5.&4.&3.&2.&1.&"
              }
            }
          }
        }
      }
    }
  }

in order to include the object "items" as well.

If the order of the object matters, then use the following, in which each of them written individually, instead of the above one

  {
    "operation": "shift",
    "spec": {
      "*": {
        "*": {
          "*": {
            "integrationEntityH*": "&3.&2.&1.&",
            "integrationEntityD*": {
              "*": {
                "externalId": "&5.&4.&3.&2.&1.&",
                "status": "&5.&4.&3.&2.&1.&",
                "poHeader": "&5.&4.&3.&2.&1.&",
                "items": "&5.&4.&3.&2.&1.&"
              }
            }
          }
        }
      }
    }
  }
  • Related