cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
723
Views
0
Helpful
1
Replies

UCCX Script XML - Duplicated Variable

cesarpuga
Level 1
Level 1

Assume the following XML document exists:

      <con:consultaSaldosTarjetaCreditoResponse>

         <CARD_NUMBER>111111111111</CARD_NUMBER>

         <CARD_HOLDER_NAME>#################</CARD_HOLDER_NAME>

         <CREDIT_LIMIT>5000</CREDIT_LIMIT>

         <CREDIT_LIMIT_CCY>USD</CREDIT_LIMIT_CCY>

         <MAX_PAYMENT_DATE>20181005</MAX_PAYMENT_DATE>

         <LAST_CUTOFF_DATE>20180910</LAST_CUTOFF_DATE>

         <con:consultaSaldosTarjetaCreditoResponseType>

            <con:consultaSaldosTarjetaCreditoResponseRecordType>

               <OVERDUE_BALANCE>0</OVERDUE_BALANCE>

               <FLOATING_BALANCE>0</FLOATING_BALANCE>

               <CURRENT_BALANCE>100.00</CURRENT_BALANCE>

               <PURCHASES_LIMIT>42955</PURCHASES_LIMIT>

               <WITHDRAWAL_LIMIT>32216</WITHDRAWAL_LIMIT>

               <PAYMENTS_TODAY>0</PAYMENTS_TODAY>

            </con:consultaSaldosTarjetaCreditoResponseRecordType>

            <con:consultaSaldosTarjetaCreditoResponseRecordType>

               <OVERDUE_BALANCE>0</OVERDUE_BALANCE>

               <FLOATING_BALANCE>0</FLOATING_BALANCE>

               <CURRENT_BALANCE>200.00</CURRENT_BALANCE>

               <PURCHASES_LIMIT>5681.88</PURCHASES_LIMIT>

               <WITHDRAWAL_LIMIT>4261.41</WITHDRAWAL_LIMIT>

               <PAYMENTS_TODAY>0</PAYMENTS_TODAY>

            </con:consultaSaldosTarjetaCreditoResponseRecordType>

         </con:consultaSaldosTarjetaCreditoResponseType>

      </con:consultaSaldosTarjetaCreditoResponse>

 

 

For the "Get XML Document Data" step i am using the following XML Path: "//*[local-name()='CURRENT_BALANCE']"

What would be the appropriate "xml path" way to obtain the value of both variables (CURRENT_BALANCE).

1 Accepted Solution

Accepted Solutions

Anthony Holloway
Cisco Employee
Cisco Employee

You have to use an XPATH predicate like this:

 

//CURRENT_BALANCE[1]

//CURRENT_BALANCE[2]

etc.

 

Therefore, your xpath needs to be built at run time like this:

 

 

label Get Next Balance
increment i
xpath_balance = "//CURRENT_BALANCE[" + i + "]"
xpath_balance = Get XML Document Data (xml_doc, xpath_balance)
if (xpath_balance != null && xpath_balance.trim() != "")
  true
    /* Data Found - Store the data in the balance variable */
    set balance = xpath_result
    ...Your record processing steps go here...
    goto Get Next Balance
  false
    /* No Data Found - End the loop */
    goto End of Record Set
label End of Record Set

 

Source for more info: http://www.w3schools.com/xpath/xpath_syntax.asp

 

EDIT: Added more detail to the script example.

View solution in original post

1 Reply 1

Anthony Holloway
Cisco Employee
Cisco Employee

You have to use an XPATH predicate like this:

 

//CURRENT_BALANCE[1]

//CURRENT_BALANCE[2]

etc.

 

Therefore, your xpath needs to be built at run time like this:

 

 

label Get Next Balance
increment i
xpath_balance = "//CURRENT_BALANCE[" + i + "]"
xpath_balance = Get XML Document Data (xml_doc, xpath_balance)
if (xpath_balance != null && xpath_balance.trim() != "")
  true
    /* Data Found - Store the data in the balance variable */
    set balance = xpath_result
    ...Your record processing steps go here...
    goto Get Next Balance
  false
    /* No Data Found - End the loop */
    goto End of Record Set
label End of Record Set

 

Source for more info: http://www.w3schools.com/xpath/xpath_syntax.asp

 

EDIT: Added more detail to the script example.