CloudDB Dynamic Tag Names Problem

Greetings, All,

I want to really express my appreciation of all of the hard work and enlightening discussions on this forum. Through careful reading of your debates and explanations, I have come very close to finishing my first serious app project!

However, I have been banging my head against a particular brick wall for a few days now, and rather than keep trying to "push the rope," I've finally given in and decided to ask for your sage advice. Below, I have pared down the larger project to a test case that illustrates my intractable problem. I hope my format is concise and easy to understand.

BASIC INFO

  • I am testing using companion, running on Nox emulator, set to Android 7 OS.

  • For CloudDB, I am using a free Redis server from redislabs.com. I can see the values of all my tags set properly in the database (including Base64 encoded images) while I am testing.

DESIRED OUTCOME
I am attempting to save and retrieve an image to CloudDB using a dynamically generated tag name.

PROBLEM DESCRIPTION
While I can successfully save the image to CloudDB on Screen1 (the actual image, not just the path) with a dynamically generated tag, I cannot retrieve it on a different screen by dynamically generating the same tag.

DETAILED DESCRIPTION
On Screen1, I create the CloudDB tag using a variable set to text entered by the user in a notification window. On scr_DataCheck, I use GetValue/GotValue blocks to first retrieve the variable stored from the notification window, and then use that retrieved variable to create a tag name for use in a subsequent "GetValue" block. This process fails to retrieve the image from the CloudDB.

However, if I then use "Do It" to run the GetValue block again, the process works correctly the second time. I have tried a number of ways to solve this problem, but none have worked.

HYPOTHESIS
My theory is that the variable "CurrentPuppyFace" doesn't get parsed the first time, when the GetValue block encounters my tag definition, which uses a Join block to slip the value of "CurrentPuppyFace" into the tag definition.

WHAT I HAVE TRIED SO FAR

  1. I changed the "Call variable" block in the CloudDB GetValue tag definition to a string containing the target name. This works perfectly, but of course, this means the user cannot set the name using the text input notification.

  2. I tried moving the first 3 GetValue blocks into a separate procedure, then calling that procedure first in the .Initialize block, and then running the last GetValue block (i.e., the one with the dynamic tag definition) afterwards. That did not change anything.

  3. I tried repeating the last GetValue block in .Initialize. That did not change anything.

  4. I tried adding a copy of the last GetValue block as the last item inside the "GotValue" block. This successfully loaded my target image ("Stored Puppy Face" on scr_DataCheck), but then removed the image retrieved from CloudDB's "tag_CurrentPuppyFace" tag.

The only way I can seem to get both images to display is to manually re-run the last GetValue block from inside the development environment.

I am vexed. Can anyone offer some clarity?


CloudDB_BackToBasics.aia (25.8 KB)

Why dynamically generate the tag again ? You create it when you save the image in the first place, so use that tag (save to tinydb or variable), this will ensure that it matches.

Alternatively

You can also call back the tagList and test your second dynamically generated tag against the tags in the list, if there is a match, then you can return the image

Thanks for your quick response!

Using GetTagList did the trick. Solution shown below.

I would still like to know why my original method didn't work. My tinkering shows that the "get global CurrentPuppyName" block is parsed in every possible position in the GotValue block--except when inside the If/Then statement containing the dynamically generated tag. Weird....

In any case, this workaround is fine, and I thank you, TIMAI2, for your help!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.