-
June 2nd, 2021, 20:43 #1
Creating a child node with autogenerated name
Both DB.createChild and databasenode.createChild have the following documented for the 'name' parameter:
Code:name (string) [optional] A relative node identifier specifying the child node to find. If this parameter is omitted, a new unique node name will be generated.
In general, how do you directly create a typed node with an autogenerated name?Last edited by darrenan; June 2nd, 2021 at 20:51.
-
June 2nd, 2021, 20:49 #2
<dbnode>.createChild() and DB.createChild(<dbnode>) will create a new intermediary node with the usual auto generated id-XXXXX name. I don't think you can create an auto generated node name and specify a type.
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!
-
June 2nd, 2021, 20:54 #3
Ok, seems like I can get around it by just adding one more level of node.
-
June 2nd, 2021, 21:38 #4
The usual naming convention is that intermediary nodes will have id-XXXXX or a name (but no type) - the vast majority will be id-XXXXX, you'll see that everywhere in FG db.xml (campaign and modules). I'd stick with that naming if you're creating a child that will have multiple entries under it.
If it's a child with just one entry, then use a meaningful unique name.
I'm not sure what you're trying to do, so can't make definite recommendations. So I don't know if adding one more level of code is the way to go or not.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!
-
June 2nd, 2021, 22:38 #5
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,559
If you are creating a value node; then you should probably be using a unique name anyway.
The auto-generated child names are more for branch nodes that represent whole records.
Regards,
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks