My aim was to create a Single Value set to a random Row Id from another table. This would then be used to present a random quote at the top of an Add Form.
I expected to see something like this screen grab from this video:
Instead of a single value for each row I see a different value for each row as follows:
I am concerned about the implied overhead (a random selection from a large table for every row in another large table).
Any advice as to why I am seeing a different value for each row?
I am aware that what I am trying to do wonāt actually work because I canāt seem to show any calculated rows in an Add Form anyway. So suggestions on how to show a random quote as a ālabelā at the top of an Add Form would also be welcome. (Please bear with me as I am a novice with Glide so Iāve probably missed something obvious. I have searched the forums and documentation.)
Just out of curiosity, why not use the single value to pull the random quote directly?
How big is the table? Unless youāre talking about tens of thousands of rows, I donāt believe that would be an issue. Even then, itās probably not a problem.
That appears to be how it works. To be honest, I donāt use Single Value->Random that often, so I donāt recall if that is correct behaviour, or a bug.
Yes, you should be able to, as long as the column exists in the table the form is directed at. Just add any sort of text component and point it at your random quote. (I just tested this to be certain, and it works).
I can set a value from a column on an Edit Form but the columns do not appear on an Add Form. I think I spotted this before but Iām getting confused:
A trivial app displays the same characteristics with Random Single Value, displaying multiple values on different rows. I guess I misunderstood the semantics of single value.
Yes and Iāve just been able to add it as a Text Edit component in an Edit Form. Are you sure you were looking at an Add Form? Your crumbs say Form while mine say Add Form, why would that be do you think?
Working with an App and the default Add Form that is accessed from the list view of a table. I did not create a ācustomā form like your sample app shows. So I am guessing that adding calculated columns in that default Add Form is disabled and that you were using a custom form (maybe itās an option set someplace but I did not set it).
Add Form is different from a Form. An Add Form is not connected to a row, where a Form IS connected to an underlying parent row. At most you may be able to add text from the user profile table, but that would be it (not even sure if thatās possible either).
@Darren_Murphyās last suggestion would be the way to go.
Yes, you can add fields from user profile. A calculated field based on another table is an independent variable, it does not require a parent but I now understand the restriction and will learn more about creating custom data entry fields.
I also now understand that the original issue is my misundersting of Single Value semantics where I thought it was a singleton relative to table rows and, clearly, it is calculated once per row. Not sure why I would use a Single Value for that random case but at least I understand it better.
Thanks @ThinhDinh, Iām still working through the scenario to work out how often the values are recalculated to see if I will continue to use this feature or try something else.
Not that it matters but It seems to me that the way random works does not gel with the description and the video in the Glide Docs. An inconsistency like this might require a software change but it might just as easily be resolved by updating the documentation.
That video is from the earliest days of Glide. They have updated the usage of the single value column a lot more over the years, so I agree that video needs to be updated, especially for the ārandomā usage.