Home > other >  Pass default values in JOLT
Pass default values in JOLT

Time:11-25

I am trying to pass default value in JOLT. While passing I am getting the default value multiple times in an array. I tried cardinality with "*" but still I am getting error.

I tried-

"*":"ONE" in cardinality spec.

Below are the input, spec and output ss. Any idea on how to solve this. If any more information is required then please let me know.

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": "addy",
          "WG_REQ_LAST_NAME": "Easdls",
          "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": "asdddsuranceCo",
          "ADDRESS1_BU": "xyzCOMPANIES",
          "ADDRESS2_BU": "HOMEOsdFFIsdCE",
          "ADDRESS3_BU": "1PsddARKCIsdRddsdCLE",
          "ADDRESS4_BU": "",
          "CITY_BU": "xyzCENTER",
          "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": "asdsdsd",
          "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": "asdsdsd",
          "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": "sdasdadspPods,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": "asdasddOMPANY",
              "ADDRESS1_SHIPTO": "asdsdsdCOMPANY",
              "ADDRESS2_SHIPTO": "1PARKCIRCLE",
              "ADDRESS3_SHIPTO": "POBOX5001",
              "ADDRESS4_SHIPTO": "",
              "CITY_SHIPTO": "xyzCENTER",
              "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": ""
        }
      }
    }
  }
}

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",
              "*": {
                "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": {
      "*": {
        "*": {
          "*": {
            "*": {
              "*": {
                "*": "ONE"
              }
            }
          }
        }
      }
    }
  }
]

Output-

enter image description here

CodePudding user response:

Your cardinality was wrong according to your input. please test 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",
              "*": {
                "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"
                }
              }
            }
          }
        }
      }
    }
  }
]

CodePudding user response:

After having added the missing asterisks, you should determine where exactly to put the identifier "ONE". (eg. separate the cases)

In this case, consider using the following spec to the end of the current one

[
....,
  {
    "operation": "cardinality",
    "spec": {
      "*": {
        "*": {
          "*": {
            "integrationEntityDetails": {
              "*": {
                "*": "ONE"
              }
            }
          }
        }
      }
    }
  }
]

you got error because depth of the object labeled "integrationEntityHeader" is not equal(less than) to the object tagged "integrationEntityDetails"

So, you might also consider using

,
  {
    "operation": "cardinality",
    "spec": {
      "*": {
        "*": {
          "*": {
            "integrationEntityHeader": {
              "*": "ONE"
            },
            "integrationEntityDetails": {
              "*": {
                "*": "ONE"
              }
            }
          }
        }
      }
    }
  }
]

to include both cases(if it was needed)

  • Related