Jump to content

XMLDom - Call optimisation


WSorich
 Share

Recommended Posts

Hello,

I have working code for a simple _XMLGetValue call, but am not satisfied with my own execution of it.

Is there a way I can wrap the first two lines into a single statement?

I.e. can I reference an item in a returned array and assign it to a variable in a single line?

I'm still getting my programming legs, so if this is an easy question, I apologise now. :D

Cheers, Wal.

$ret = _XMLGetValue("/results/data/row[@num="&$result_number&"]/IDCODE")
$returned_result[21] = $ret[1]

$ret = _XMLGetValue("/results/data/row[@num="&$result_number&"]/TIMESTAMP")
$returned_result[20] = $ret[1]

$ret = _XMLGetValue("/results/data/row[@num="&$result_number&"]/YN_ACTION")
$returned_result[19] = $ret[1]

$ret = _XMLGetValue("/results/data/row[@num="&$result_number&"]/TEXT")
$returned_result[18] = $ret[1]

$ret = _XMLGetValue("/results/data/row[@num="&$result_number&"]/TYPEINDICATOR")
$returned_result[17] = $ret[1]
Link to comment
Share on other sites

No, there isn't. You can either leave it as it is, or put it in a function. I would go with the function.

$Returned_Result[21] = Function("/results/data/row[@num=" & $result_number & "]/IDCODE")

Func Function($String)
Local $Ret = _XMLGetValue($String)
Return $ret[1]
EndFunc
Edited by dantay9
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...