reverted to an old version and this is workin...

references
(Kevin Richard) #1

reverted to an old version and this is working again

I’m having issues with a Ref to another table ID getting put in when I add a record to the child table.

I have done this in other tables on the same app and it works, but from Customer to Order it’s leaving the “CustomerID” blank everytime I create a new order for a customer.

I know that is vague in way but that’s the thing… it seems vague.

Second column is set to Ref and in the details I pick the CustomerInfo Table and it picks up that it needs the CustomerID as the ReferencedKeyColumn.

I have it set to readonly and required, but every new order I create just leaves that field blank.

Then when it shows records for that customer it list every record because they all match.

Which they shouldn’t because it’s set to select based on CustomerID matching.

Hmmm

Any ideas?

Do I need to just delete that table and start again?

(Kevin Richard) #2

Just noticed another oddity.

There is no reference of a link FROM Customer Info to Order Info.

(Kevin Richard) #3

I broke it… I renamed that virtual column… now I just have to figure out how to make it again. :slight_smile:

(Levent KULAÇOĞLU) #4

@Kevin_Richard we can always make mistakes as it’s a nature of us. Provided you broke a ref ( others will not bother you that much really ), you can always set it back with checking and if needed editing the REF_ROWS expression in the related table’s virtual column. The expression’s structure is very basic:

REF_ROWS(“RefTableName”, “RefColumnName”)

(Kevin Richard) #5

@Levent_KULACOGLU Yeah, I don’t know what I did, but I couldn’t get it back.

I hadn’t done much work after causing the problem, so it wasn’t too hard to redo it.

(Levent KULAÇOĞLU) #6

Provided you set any column to read-only, it does not record anything to the base sheet :slight_smile:

(Levent KULAÇOĞLU) #7

And provided you have the same key column of a table in another table (which is a normal column), AppSheet assumes there is a link/relationship between those 2 tables and creates a REF column automatically.

(Kevin Richard) #8

I just reverted back to before I hacked it up.

So I’m good… just had to redo a bit of work.

(Kevin Richard) #9

@Levent_KULACOGLU I did make it Read Only at one point, but then I turned that off.

I also renamed the auto generated virtual column.

One of those broke it.

Thank you for the advice.

(Levent KULAÇOĞLU) #10

@Kevin_Richard what broke it was setting it to a read-only. You can always rename the auto-generated virtual columns for related tables

(Kevin Richard) #11

@Levent_KULACOGLU So I can’t even put it to “read only” and then change it back?

(Levent KULAÇOĞLU) #12

@Kevin_Richard why would you need to assign a read-only to a REF column? it’s against its nature actually :slight_smile:

(Kevin Richard) #13

@Levent_KULACOGLU I mean, if I made a mistake like I did.

I thought I was making the right call but then I realized I wasn’t… so I switched it back.

At that point though, it’s just botched for good?