I have a Firebase data set that houses user data (Name, Address, Phone). My app allows new users to add their own data to the database.
Data Structure looks like this:
Users
.....John Smith
.....Steve Clark
..........Steve Clark
..........2019 Main Street
..........123-555-3456
..........01-01-1998
..........Red Baron
.....Mary Jones
...etc
2 searches I am wanting to accomplish are is there already a 'Steve Clark' and is there already a 'Red Baron' in the database. If user 'Steve Clark' already exists I can notify the user that name is already in use, as well as the chosen nickname of 'Red Baron'. Those fields need to be unique.
I think because I have nested loops that the Dictionary blocks are the way to go but I guess I dont understand them yet. I need to be able to 'walk' through the keys of all the users to see if there are duplicates.
I may have spoken too soon .. I thought it worked when I first looked at it but I see some issues. I understand what the block does and the logic would be perfect.
One 'new' issue I have is I am already using a GetValue tag elsewhere in my app so I will need to be very creative with the TAG and VALUE from the GotValue blocks after the GetValue runs .. or can I add a second FirebaseDB and configure it with the same values as DB1?
Why doesnt this work for me? Is there a better way? The GetValue method is going to be a struggle considering I am already using that block for something else..
I set the LOGIN variable to "Login" when user presses the Login button and to "NewUser" when the user presses the button to create new accts.. those happen at the beginning of the app.
I am not sure I understand what you mean by "FireBaseDBCheckUserExists." Is there an existing routine/block that can do this for me? I would not mind the extra clutter in the Designer if there is, I am already having issues making mine work.
Go into the Designer and locate your FireBaseDB1 component.
Click on it to select it, then hit Ctrl-C on your keyboard.
Then hit Ctrl-V.
That will give you a second one, which you can rename in the Designer and use as you see fit.
Watch for the events that got copied along with the component.
P.S. Here is an example of using this technique, from an obsolete sample based on the dead Fusion Tables component:
Notice the components ftbAvailable, ftbUpdate, ftbInsert components.
Instead of using a second Database, I opted for the If\Then method in the GotValue blocks. If "New User" then do these things. If "Existing User" then do these things.. works just fine for me.
I did solve my issue of looking for duplicate user names using this method
I perfome a GetTagList to populate the 'global allUsers' list and it works, I dont know why I had so much trouble before.
I am now stuck on the second part, I am trying to search for duplicates of a different field, located deeper in my database and cant figure it out yet..
I have tried these two methods but they only give me a list of the Keys and not the Values..
I am wanting to search the ChatName field. The issues is the name of the Key is different for each user (its their username) so I cant hard code that. Since there are multiple users I figure the List By Walking Key Path is the best way to go, but I still only get Key and not a complete pair with the Value. Any pointers?
If I understand this correctly, ListPicker requires a manual selection of the desired choice, yes? I am needed something automated for when a new user is creating an account. Something that will check to see if their choice of Chat Names is already in use or not .. so I dont think this solution will work for me.
OK, sorry, didn't read the entire thread to grab that important piece of information!
What the Firebase developers usually recommend, when wanting to easily get at "buried values", it to make a separate list of these values under a different node, e.g. ChatNames, then all you have to do is return a taglist of those entries, and check the proposed chatname against the list.
This separate list is "as well as", not "instead of" what you already store for the user.
I like this idea. It would not be much trouble for me to create a seperate list for the Chat Names .. and certainly would be easy to use. I am going to give this a shot.
OK so I have a new list for chat names in the database and it saves the data the way I want just fine. But I now have an issue that I suspect has to do with the Get Tags block.
I can perform the first GetTags and it populates my user list just fine, I can check for duplicate users just fine and everyone is happy.
When I execute the second GetTags to populate the chat names list, thats when things get crazy and broken.
Does the execution of a GetTags affect anything else when they are run? Can I run them more than once? I am trying to populate two different lists with two different sets of tags using an If - Then block .. if variable = 1 then set bucket to "Users", and then GetTag. If variable = 2 then set bucket to "ChatNames" and then GetTag but that doesnt seem to work?