playMaker

Author Topic: Datamaker XML and Resource Load action [SOLVED]  (Read 7396 times)

junglist

  • Playmaker Newbie
  • *
  • Posts: 21
Datamaker XML and Resource Load action [SOLVED]
« on: April 28, 2016, 06:01:39 PM »
Hello!
So i am trying to load an XML file that is in my resources folder. This file needs to be selected dynamically, there are multiple variations of the file.

First i run the 'resource load' action, which has no problem pulling all of the XML data into a string variable.

Next I run 'xml select nodes' with it set to variable, the same variable i saved my XML to.

I can get node list properties no problem. The trouble is when i need to load a new XML. I want to save to the same string variable, use the same reference for the XML lookup.

The resource load action populates the string correctly, xml select node action counts the nodes properly and displays the proper information in the xml preview. When i select nodes though its as if the new variable data is being ignored. I have done a lot of research on datamaker lately and i know it is due for upgrade, but i need to get this dynamic resource loading working otherwise i will have to stuff all of the dynamic data into a massive xml file, making it hard for others to edit the xml. Obviously I chose to use xml because its relatively simple to understand, and easy to make adjustments.

Thanks
« Last Edit: May 05, 2016, 09:18:13 AM by junglist »

memetic arts

  • Full Member
  • ***
  • Posts: 141
Re: Datamaker XML and Resource Load action
« Reply #1 on: April 28, 2016, 09:23:54 PM »
This is a bit of a hack, but did you try clearing the string first, before repopulating it?

e.g. myStr = "";

And then repopulate it with the new XML file. . .

Wondering, though, why do you have to reuse the var? Why not just declare a new one?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Datamaker XML and Resource Load action
« Reply #2 on: April 29, 2016, 05:33:21 AM »
Hi,

 Are you sure it's not just your Xpath query string that returns nothing?

what actions are you using to get into the xml data and extract data?
Bye,

 Jean

junglist

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Datamaker XML and Resource Load action
« Reply #3 on: April 29, 2016, 09:45:25 AM »
This is a bit of a hack, but did you try clearing the string first, before repopulating it?

e.g. myStr = "";

And then repopulate it with the new XML file. . .

Wondering, though, why do you have to reuse the var? Why not just declare a new one?

Yes i clear the str before i use resource load. I have to reuse the var because the xml reading is done in a looping situation.

I have a sort of dictionary of xml files that need to be loaded. So i go through the dictionary, setting the resource load path dynamically. As the resources are loaded they are parsed until all the dictionary entries have been read.

junglist

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Datamaker XML and Resource Load action
« Reply #4 on: April 29, 2016, 09:49:50 AM »
Hi,

 Are you sure it's not just your Xpath query string that returns nothing?

what actions are you using to get into the xml data and extract data?
Bye,

 Jean

I am using editix to write my XML, its very nice. I can check the xml there and give it xpath queries to quickly find out if the query is valid, which they are.

My xml is structured like:

items
 item
 item
 item
/items

so i use "XML select nodes" and "XML get next node list properties" to parse the doc. I believe the problem is coming from XML select nodes being set to "use variable", I have even tried incrementing the xml memory reference, that didnt help.

junglist

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Datamaker XML and Resource Load action
« Reply #5 on: April 29, 2016, 10:32:23 AM »
Jean,
Here is a unity project for you to check out if you want

[Moderation] [LINK REMOVED] Please do not share full projects with PlayMaker included :) only share publicly what's not paid assets or where licenses authorise public distribution

Bye,

 Jean
« Last Edit: May 02, 2016, 09:38:18 AM by jeanfabre »

junglist

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Datamaker XML and Resource Load action
« Reply #6 on: May 02, 2016, 08:53:38 AM »
bump!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Datamaker XML and Resource Load action
« Reply #7 on: May 02, 2016, 09:38:43 AM »
Hi,

 I'll have a look tomorow ( btw, don't share PlayMaker publicly please :) )

Bye,

 Jean

junglist

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Datamaker XML and Resource Load action
« Reply #8 on: May 02, 2016, 10:42:15 AM »
Sorry didn't even think about that! Thanks Jean!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Datamaker XML and Resource Load action
« Reply #9 on: May 05, 2016, 03:43:27 AM »
Hi,

 Ok, this is a good case indeed. All is working fine, but here's the catch!

when you use the action XmlGetNextNodeListProperties several time within the same fsm, there is an internal problem of handling data for me to be able to loop back, so there is a "Reset" bool variable you need to set to true, when the loop should start with a new set of data AND from the first entry.

 so, in Loadfile, just before loading your resource and launch the procedure, raise a "Reset loop" bool to true, and reference that "reset Loop" in the "get data" state within the action "XmlGetNextNodeListProperties" and now it will properly start again, AND take in consideration the reset flag. you'll end up with your dataTable properly loaded with stuff!

 Have a go, and let me know if this is not clear.

 Bye,

 Jean


junglist

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Datamaker XML and Resource Load action
« Reply #10 on: May 05, 2016, 09:17:37 AM »
Thanks Jean that works!

Just wanted to add that it was picking up the previous data's index even with reset bool set to true. So where i set the bool to true, i also set the index to 0 and everything is perfect.
« Last Edit: May 05, 2016, 09:47:05 AM by junglist »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Datamaker XML and Resource Load action [SOLVED]
« Reply #11 on: May 05, 2016, 11:09:21 AM »
Hi,

 Yeah, it's a bit convoluted, but I never found a better way to properly handle easy looping. the other way is to manually loop, but this is way too much overhead especially if the list is getting longer.

Bye,

 Jean

junglist

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Datamaker XML and Resource Load action [SOLVED]
« Reply #12 on: May 05, 2016, 07:11:09 PM »
I dont think its too bad really. Your tools are incredibly useful, i follow playmaker development closely and use it every single day. Youve given us so many tools that make playmaker production ready and are always here to support! Thanks again Jean!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Datamaker XML and Resource Load action [SOLVED]
« Reply #13 on: May 06, 2016, 01:34:58 AM »
Hi,

 Thanks :) I am glad I can help!

 Bye,

 Jean

PunkMunkey

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Datamaker XML and Resource Load action [SOLVED]
« Reply #14 on: August 11, 2016, 11:31:16 PM »
I'm having the exact same problem here as junglist. I'm changing variables in the xpath query to load different sections of data from my XML file, but it just keeps loading the same set over and over. Whatever set I load first is the only one it will ever load...

I'm not sure how to use the reset variable in the XML Get Next Node List Properties. Whether I have it set to true or false, it keeps loading the same results.

Any help would be appreciated.