Sign in to follow this  
Followers 0
WSorich

XMLDom - Call optimisation

2 posts in this topic

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]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
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
Sign in to follow this  
Followers 0