Pages: [1] :: one page |
|
Author |
Thread Statistics | Show CCP posts - 2 post(s) |
lancemate
Hax. Northern Coalition.
0
|
Posted - 2014.11.08 15:22:29 -
[1] - Quote
Hi,
I am trying to convert the following xml import string to a script given the awful caching buggyness of the importxml function in Google sheets.
=ImportXML("http://api.eveonline.com/corp/StarbaseDetail.xml.aspx?keyID=xxxxx&vCode=xxxxx&itemID=xxxxx&","//row[@typeid=4247]/@quantity")
I would like itemID (tower ID) to be populated by the contents of another cell since I am already importing all our POS ID's with another script I found on this forum. I tried to adapt this script to get my intended result but I am failing miserably and only know JavaScript on a basic level. This is what I have come up with:
http://pastebin.com/DYZKF40X
It's failing pretty hard right now telling me it cannot call method getValue() of null.
I can see I am not parsing the fuel ID anywhere from the importXML command which I imagine is the problem, I have tried various ways of adding this to the code but to be honest I have no idea what I'm doing v0v.
Any help would be much appreciated. |
Steve Ronuken
Fuzzwork Enterprises Vote Steve Ronuken for CSM
4146
|
Posted - 2014.11.08 18:30:44 -
[2] - Quote
I suspect the problem is you're using getChild, where you should be using getAttribute
try flipping the two getChilds for your tower=[] to getAttributes, and you should be good.
Explanation: getChild is for use, when an XML tag contains another XML tag. getAttribute is for use when you want to get at an attribute inside the tag declaration. like typeID='blah'
< row typeID="16273" quantity="4878" >< /row>
Is where you'd use getAttribute
< row>< typeID>16273< /typeID>< quantity>4878< /quantity>< /row>
if where you'd use getChild
aside from that, I'd also suggest parseInt(rows[i].getAttribute("quantity").getValue()) so that it shows up as a number, rather than as a bit
Woo! CSM 9!
Fuzzwork Enterprises
Twitter: @fuzzysteve on Twitter
|
lancemate
Hax. Northern Coalition.
0
|
Posted - 2014.11.08 18:55:40 -
[3] - Quote
Thanks for taking the time to look at this.
I did try what you suggested but I still seem to be getting errors.
I think the problem may be in the importXML string I am specifically asking for a quantity where typeID matches 4247 (Amarr fuel block) wheras I just couldn't figure out how to get this into the script.
I created a new pastebin reflect your suggestions. |
Steve Ronuken
Fuzzwork Enterprises Vote Steve Ronuken for CSM
4146
|
Posted - 2014.11.09 00:04:58 -
[4] - Quote
StarbaseList isn't the one you want.
StarbaseDetail is. I should have noticed that.
Woo! CSM 9!
Fuzzwork Enterprises
Twitter: @fuzzysteve on Twitter
|
lancemate
Hax. Northern Coalition.
0
|
Posted - 2014.11.09 00:55:31 -
[5] - Quote
Steve Ronuken wrote:StarbaseList isn't the one you want.
StarbaseDetail is. I should have noticed that.
Yep, I noticed about an hour ago also, I can't believe i spent all that time messing around with the script when my url was wrong :-)
Script has evolved a little with the help of a friend if you're interested: link it now pulls only the quantity where the fuelID is a specified ID which is more in line with what I needed.
My next question if you might know I'd be very grateful, I'm pulling my towerIDs etc from StarbaseList in another script, what is the easiest way to convert IDs such as typeID and locationID for example to in game names (tower type, system name.) I know about the static dump databases but I was kind of hoping there was an online resource I could cross reference?
thanks again. |
|
|
|
Pages: [1] :: one page |
First page | Previous page | Next page | Last page |