-
May 30th, 2023, 20:01 #1
- Join Date
- Jul 2009
- Posts
- 66
Issue with getting Value from a node in DB
I am trying to retrieve a value from a node in the DB. I hard coded the strings to try and figure out why I am not getting the value.
Code:function CharacteristicRoll(rSource, rTarget, rRoll) local Target = DB.getValue("charsheet.id-00001", "wsCurrent", 0); Debug.chat(Target); end
-
May 30th, 2023, 20:18 #2
You can only specify a child if the source is a database node object, not a string. As you're using a string, the second argument is the default value to return.
See here: https://fantasygroundsunity.atlassia...82/DB#getValuePrivate Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
May 30th, 2023, 20:44 #3
- Join Date
- Jul 2009
- Posts
- 66
how do you get the database node object in a script? I know of window.getDatabaseNode(). But it doesn't work in the action script. I have the type from rSource.
-
May 30th, 2023, 20:55 #4
DB.findNode can be used to get the node from a string node name: https://fantasygroundsunity.atlassia...82/DB#findNode
However, you can concatenate "charsheet.id-00001" and "wsCurrent" into a single DB path: "charsheet.id-00001" .. "." .. "wsCurrent" then use DB.getValue on the complete path.
See here for information on database paths: https://fantasygroundsunity.atlassia...Database-Paths
Try this:
Code:local Target = DB.getValue("charsheet.id-00001" .. "." .. "wsCurrent", 0);
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks