Single Value shows different actual value in Data Editor

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:
image

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.)

Thanks in advance, Matt

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).

1 Like

I wanted to pull some other data as well

Not too big but it makes me uncomfortable to get random O(n) x O(m) when all I need is random O(n). It makes me shiver :wink:

Starting to look like a bug to me but like you say, maybe it doesnā€™t matter.

I must be doing something stupid, none of my derived columns appear in the Add Form as field option. Iā€™ll keep playing around.

Thanks v. much @Darren_Murphy

For me, none of my calculated columns are visible in the text entry / General / Column drop down. Why cannot I set Text Entry to show Quote column?

image

Iā€™m sure Iā€™m missing something obvious and so Iā€™ve headed off to the new Glide Uni :mortar_board:

Yeah, I think the something obvious that youā€™re missing is that you are using a Text Entry component.
Try a normal text component :wink:

1 Like

Dā€™Oh! Thanks.

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:

Nope.

The test I did was with an Add Formā€¦


image

I gotta go back to school because this is over my head but thanks for being so helpful @Darren_Murphy

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.

Are you sure that your Single Value column is in the same table that your Form will be adding its row to?

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?

Can you tell me how you got to your Form Screen, so I can replicate exactly what you have?

With my test, I used a Form Button:

Also, are working with an App, or a Pages Project?

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).

No, I wasnā€™t using a custom form. Just a slightly different Add Form.

Anyway, I just retested using the same method as you, and yes I get the same behaviour as you.

What you could do is:

  • Switch from a List Layout to a Details layout
  • Add an Inline List component
  • Add a Form Button (as per my earlier screen shot)
  • And you should be able to use your random quote on the resultant Form Screen
2 Likes

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.

3 Likes

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.

Many thanks to @Jeff_Hager and especially to @Darren_Murphy for being so patient.

2 Likes

Yes, it has always worked like that and I have used this quite a few times when I donā€™t need to present different people with the same random thing.

2 Likes

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.

1 Like

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