Help needed - Computed keys limitation?

I am new to Appsheet.

On the face of it, Appsheet looks promising - I had been trying to work with PowerApps but the licencing issue were just too much to get on top of. Hence my look into Appsheet.

However I appear to have come to an early (and disappointing) impasse. It appears to me (I hope I am wrong) that Appsheet cannot handle any relationships in Google sheets other than the most basic (Order / Item type). When it comes to composite keys it doesnโ€™t appear to know what to do.

So I am wondering if Appsheet is a tool for anything more than a very basic application. I really donโ€™t want to spend a lot of time going down (another) rabbit hole to discover that it leads nowhere.

I have an application, that can be modelled quite easily using a traditional relational DB, and in Google Sheets with a bit of imagination. I would like some opinions as to whether I am wasting my time on this platform or if I am just missing something fundamental. I am willing to engage Appsheet experts to get me over this hump if necessary.

Thanks,

Roryf

0 17 333
17 REPLIES 17

Hi @Rory_Forde ,

Please take a look at the following AppSheet help articles just in case you have not

https://help.appsheet.com/en/articles/1023086-what-is-a-key

https://help.appsheet.com/en/articles/961426-references-between-tables

No

AppSheet kinda follows the rules for RDB but not 100%. Some things like 1-to-1 need workarounds

Iโ€™m lost here. Can you explain it to us a little bit better?
โ€˜Relationships in Google sheetsโ€™ doesnโ€™t sound like a thing. What do you mean?
Composite keysโ€ฆ you need sequential keys or something?

Gotcha

You can, although I strongly suggest you not to do it.
The best way of having a key for each row is by leaving a real column for that purpose of text type and UNIQUEID() Initial Value. Also leave it hidden (Show: off) because it doesnโ€™t have any meaninfull info rather than a pseudo unique string.

Thank you @SkrOYC for taking out related specific extracts from the respective articles. You are correct that composite key equivalent โ€œComputed keyโ€ is described in the article on keys. The reason shared that article with @Rory_Forde

Also from his following statement, it appears that he could take a look at the article on referencing and then rephrase his questions better.

Yep. It all made sense once I got it. Your links are what he needs.
The whole documentation to be fair is the best place to start from my POV

Thanks for all of the repliesโ€ฆ

If I may illustrate with a simple fictional example. In a single medical practise a Doctor has many patients. But if you have many medical practises to handle a patient may also have many doctors (GP, Ophthalmologist, etcโ€ฆ). In this case you would need a composite key (PatientID & DoctorID) to identify what doctor the patient was visiting.

Can Appsheet handle this? If so where is the best place to look for tutorials on using Appsheet with more complex data structures.

Thanks,

RoryF

I still donโ€™t get it but it may be because I donโ€™t understand the usage of โ€œComposite Keyโ€. For me it seems easy from an AppSheet โ€œcreatorโ€ perspective to use a table where I just select the patient and the doctors assigned to him.

Sure, you could have this as Doctor (Parent) and Patiens (Children)

This is where my english skills might be betraying me but if I get it right you mean that there are a lot of different treatments and, consecuencially, doctors related to a single Patient. This sounds like many-to-many.

Why is it needed? It seems like just a table where you could select both is enough. Again, Key is just a hidden column that has no purpose rather than uniqueness in the context of a table, from my POV.

Your need for a composite key or the usecase? Seems like it can handle both.

Can you come up with a different example? Also it could be very helpfull if you tell us why the composite key is so important in your case

You are correct @SkrOYC. @Rory_Forde seems to be looking for many to many table relationships. These can be implemented with a bridge table in Appsheet. Below are many useful posts on implementing many to many table relationships in Appsheet.
https://community.appsheet.com/search?expanded=true&q=Bridge%20table%20%20%20%23ask

You could even do it inside AppSheet with EnumList basetype Ref on both tables, no need for the third one

Correct.

That sounds interesting - I will have to look that upโ€ฆ

Hi @SkrOYC ,

Just thought of adding a few points for discussionโ€™s sake. Even though technically one could use Enumlist with base type as a reference in both the tables without bridge table, as per my understanding, it may not be a practical solution in most cases. Of course, there may be a few use cases for that.

Consider Orders and Products. If the two are referenced to each other simply via enumlist with base type reference, it will be difficult to pull in other product attributes such as product name, product price etc. in Order table. Also summing up the order value will be difficult. So I believe in most cases a bridge table such as Order details that references both Orders and Products table makes sense from user experience perspective also.

Please take a look at the below post to understand the challenges in dereferencing column values from the parent in the case of enumlist with base type as reference.

Edit: Some edits to the post description.

Yes. Just mark both of those columns as key and AppSheet will automatically add a column named _ComputedKey that will use the two component columns to produce the composite key.

Away from AppSheet, you might want to build a better database in any case. Your problem is not with the composite key (that fellow members have shown you how to achieve), but rather your data structure is weak.

A Doctor is a Doctor
A Patient is a Patient
A Visit is neither a Doctor nor a Patient

To build on the same fictional example, you want to register visits, then Iโ€™d say you need at least the following tables:

  • A Doctors Table
  • A Patients Table
  • A Therapies Table, this will contain the names of the Doctor and the Patient, and may be a โ€œCondition/Syndromeโ€ and โ€œStatusโ€
  • A Visits Table, the visits here will be related each to a Therapy, and would contain date and time.

Thatโ€™s the way you do it.

Also, you can go further, you can create: Medication, Tests, Exercises, Diets, etc. All are tables that should be related to Therapy.

And so on.

I might be wrong but โ€œComposite Keyโ€ is a concept that may be needed outside AppSheet and completely useless or not needed inside of AppSheet.
Maybe outside AppSheet using a RDB you need to have meaninfull Keys and that kind of stuff but here a Key is just a single column where a random and hopefully unique value is asigned when the row is created to be able to ref to it later or just keep it unique in the context of a table.
Hope this helps!

BTW, this is the default expression that is used on AppSheet for uniqueness:

After learning a little bit more, the short answerโ€ฆ

Yes

AppSheet can do all of the above

For reference

Thank you all for your replies and your timeโ€ฆ

The take away for me from this discussion is that Appsheet will do what I want to do - I just have to figure it out.

RoryF

Top Labels in this Space