I am creating a simple fortune teller app. I have a users sheet in which I store name, and then a random number which is used to lookup from another sheet from a set of messages in order to show a random message as fortune.
It works perfectly fine for me, But, now when I want to make it a public app, where any other user can also get the same experience, it doesnt work.
I have created row ID for the row for a user. i tried to create a user-specific column, but it doesnt allow a look up column.
Can you clarify more on this part?
I have a Users sheet in which i have a column named Fortune Id. The fortune ID is a lookup column which randomly takes a value from another sheet which has one column with number from 1 to 300 and another column with fortune messages. Based on the fortune ID, the corresponding message is shown. I cannot make this column user specific. I also have one more qn. When is the random value generated? Is it everytime the app is loaded or everytime the screen is loaded?
If your fortune number is a random number which is user specific, then isn’t that making the message, which should be tied to that number via relation & lookup also user specific?
I’m thinking you’re creating the random number via a single value column, is it true?
The random number will be changed every time the user interacts in some way with the app if I recall right.
Yes, I am getting the message using a relation tied to the ID and then using lookup to get the message from the relation. But, I cannot make the lookup column user specific. When I select Lookup, the checkbox for making it user specific dissapears.
And, you are right, I am using a Single Value column to get random number.
When I create the app in the Editor mode, the random value changes everytime I interact with the app. But, after publishing when I use the app, it changes only when I reload the app. Is it because it is not user specific?
A lookup column will be user specific if the value it is looking up is user specific. You can’t make a computed column user specific or not user specific. It just follows whichever setting you have on the Basic Column that it is referring to. Only Basic Columns can be set as user specific because those are the only column types that actually store data. Any other column type is a computed column that’s computed as needed on the user’s device.
Lookup is a computed column that’s computed on the user’s device, so whatever value the lookup sees will be the value it returns for that user.
If you are still having issues with the random function, I would maybe create a custom action for the buttons and make one of the actions a reshuffle action. This should create a new random value.
Agreed. Did this here in Episode 4:
Hi Robert, may I know which section in the video has the mention of Reshuffle?
I think Random value generation happens only in reloading of app, though during creating the app, it happens during every interaction which is strange.
To create Reshuffle action, I will need to change the screen to the screen containing the inline list. So, there is no way to use a specific fortune ID for a user profile and then add the Reshuffle action to a button on the Users sheet. I think Reshuffle action is possible only on a Screen with an inline list.
I believe it’s around minute 14:00
I have made it into a public by email app, since public app wouldnt hold computed data as user-specific.
I have also used Reshuffle action, though I havent fully grasped how to use it.
I dont know how the action is linked to an inline list. I just added two inline lists onto a screen, and then sorted it randomly, and then deleted it.
The reshuffle seems to be working but there is only one problem.
When I click the button (Drop Sticks) which has the action Reshuffle, the reshuffle doesnt happen, But, when I click on another button Show Fortune, then the result of the previous Reshuffle action is visible, which is that the image changes. Any idea why?
Its working now. I had placed a wrong visibility condition for the image and therefore it was not changing when I clicked the Drop Sticks button. Its fine. Thanks for all the help.
I added an inapp payment for knowing the fortune after the first free fortune.
To do this, I added a Count column which will be initialized to 0 during onboarding. Then, when the Drop Sticks button is clicked, it increments Count to 1. If Count is 1, then a button (Donate $1) is shown, which leads to the Buy button for payment of $1.
I then have a Paid or Not? column which looks into the App: Purchases sheet and gets a value of True, if payment is done, and False if payment is not done.
If Paid or Not? is True, then the Donate $1 button will not be visible, as the visibility condition for Donate $1 button is: Paid or Not? Is False.
Now, I want the Drop Sticks button to reappear. But, now the count is initialized to 1. And, therefore, it will not appear since the visibility condition for the Drop Sticks button is Count is <= 0(for the first fortune). How can I have the Drop Sticks button reappear after the payment is done? What visibility condition should I use? Because, I have no way of decrementing the Count (which is now 1) after payment. Count is a Data editor column, and not a column in the Google Sheet.
Let’s say if I donate $1 then will I get just 1 turn or it’s unlimited turns?
It would be like this I guess.
Drop Sticks: visible when Count <= 0 OR Paid is True.
Donate: visible when Count = 1 AND Paid is False.
Would it work?
This is how I have configured. But, when PAID is TRUE, Count is still 1, and Drop Sticks will not be visible, since Count is not <= 0.
Ok. I got it, It is not AND but OR for Drop Sticks. Let me try
I have another problem. The Drop Sticks is one action, after which I dont immediately show the Fortune. I have another button Show My Fortune which shows the fortune. So, for this, I have two columns Sticks Dropped and Show Fortune. When Drop Sticks is clicked, Sticks Dropped is set to 1, and Show Fortune is set to 0. When Show My Fortune is clicked, Show Fortune is set to 1.
There is another button Reset, which is visible, when Sticks Dropped is 1 and Show Fortune is 1.
When button Reset is clicked, Sticks Dropped and Show Fortune is set to 0.
Now if Count is 1, then Donate button is shown.
So, the visibility conditions are:
Drop Sticks: visible when Count <= 0 AND Show Fortune is 0 AND Sticks Dropped is 0
Donate: visible when Count >= 1 AND Show Fortune is 0 AND Sticks Dropped is 0 AND Paid is False.
So, I am not able to introduce an OR in visibility conditions for Drop Sticks.
I used a Count Paid Template Column which will combine Count and Paid.
So, it will have four combinations:
Then, I added another Count Normalize column which is an If-Then-else column as per below:
If Count Paid is
1 → Count Normalize is 1
0 → Count Normalize is 0
1 True → Count Normalize is 0
1 False → Count Normalize is 1
Then I use Count Normalize <=0 instead of Count <=0 for Drop Sticks button.
So, the Drop Sticks button will appear when Count is 0 and 1 True, but not when Count is 1 and 1 False.