Starfinder Playlist
  1. #1

    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
    Target comes out as "wsCurrent" instead of the number value. Any ideas what I am missing?

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    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#getValue
    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!

  3. #3
    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.

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Product Walkthrough Playlist

Log in

Log in