Forum Discussion

sdeng's avatar
sdeng
New Contributor II
7 years ago

Convert string to object&Arrary

I have a input csv data like below:

how to format & group the data to like below and how to pass the values to worker_reference

2 Replies

  • tstack's avatar
    tstack
    Former Employee

    Are you trying to fit all of the rows from the input into the $Worker_Reference.ID array? Like so:

    {
        Worker_Reference: {
            ID: [
                { type: "Employee_ID", value: "A4" },
                { type: "Employee_ID", value: "A3" },
                { type: "Employee_ID", value: "A2" },
                { type: "Employee_ID", value: "A9" }
            ]
    }
    

    Or, is every row still a separate document, like so:

    // Document #1
    {
        Worker_Reference: {
            ID: [
                { type: "Employee_ID", value: "A4" }
            ]
    }
    
    // Document #2
    {
        Worker_Reference: {
            ID: [
                { type: "Employee_ID", value: "A3" }
            ]
    }
    
    // ...
    

    And, where does the $Provisioning_Group value fit in?

  • sdeng's avatar
    sdeng
    New Contributor II

    It’s the first one, the target customized envelope is like below:
    <SOAP-ENV:Envelope
    xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/
    xmlns:ns0=“urn:com.workday/bsvc”>
    SOAP-ENV:Header
    ns0:Workday_Common_Header
    ns0:Include_Reference_Descriptors_In_Response$Include_Reference_Descriptors_In_Response</ns0:Include_Reference_Descriptors_In_Response>
    </ns0:Workday_Common_Header>
    </SOAP-ENV:Header>
    SOAP-ENV:Body
    <ns0:Put_Provisioning_Group_Assignment_Request ns0:version=“$version”>
    ns0:Provisioning_Group_Assignment_Data
    ns0:Worker_Reference#foreach($ID in $Provisioning_Group_Assignment_Data.Worker_Reference.ID)
    <ns0:ID ns0:type=“$ID.type”>$ID.value</ns0:ID>#end
    </ns0:Worker_Reference>
    ns0:Provisioning_Group$Provisioning_Group_Assignment_Data.Provisioning_Group</ns0:Provisioning_Group>
    </ns0:Provisioning_Group_Assignment_Data>
    </ns0:Put_Provisioning_Group_Assignment_Request>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>