To register for the forums, please contact your Digital-Clay representative.

tables - linkes

Community-oriented help and tech-support for the Digital-Clay platform.
Post Reply
malkyE
Posts: 21
Joined: Thu Apr 08, 2010 10:50 am

tables - linkes

Post by malkyE »

Hi,

1. Can I coose what will be the "primary key" of a table?
how? where?
2. Can I set the linke between tables to be "a single to single"?
how?
3. Does the tables are linked together through the "primary key"? or we can coose through what field?

Thanks,

Malky.
ZevToledano
Posts: 722
Joined: Fri Apr 03, 2009 2:29 pm

Re: tables - linkes

Post by ZevToledano »

1. No. The primary key is handled automatically by the program and must be of a specific type that the program can handle. Why would you need to do this?

2. One-to-one relationship is non-standard and is not even supported by databases like SQL Server. If you need a one-to-one relationship then that usually means that it is the same table so why split it into two tables? There are very few reasons why you would need to make such a DB relationship, one of them being that you ran out of room, but in Digital-Clay you can switch to SQL Server and even then you can simply add a normal link from A-B. So my question is again, why do you need this?

3. Why would you ever need to choose? The tables are always linked through the internal primary key.
malkyE
Posts: 21
Joined: Thu Apr 08, 2010 10:50 am

Re: tables - linkes

Post by malkyE »

Thanks,

Is the "primary key" is the name field?

I have members table,
and a table with a stock of phones
Each member have one of those phone - when a phone belong to a member we can't allow it to other member ("singal to singal")
How do I set it?

Thanks,

Malky.
ZevToledano
Posts: 722
Joined: Fri Apr 03, 2009 2:29 pm

Re: tables - linkes

Post by ZevToledano »

As explained, the primary key is an internal ID field.

The name field is only what is displayed. It is never used to link two tables or as a primary key. This is a common misconception.

In your case, the linked field should be in the Phone table. I.e. the phone should have a linked field "Current Member" and that will ensure only one uses it at a time. This is not a one-to-one link.
malkyE
Posts: 21
Joined: Thu Apr 08, 2010 10:50 am

Re: tables - linkes

Post by malkyE »

Hi,

Thanks again,

1. How do I make sure that it will let one member to each phone? Where I set that? -

I made what you set but on the phone table I can coose the same memeber to more then one phone.

2. How we coose what fields will be linked together?

Thanks,

Malky.
ZevToledano
Posts: 722
Joined: Fri Apr 03, 2009 2:29 pm

Re: tables - linkes

Post by ZevToledano »

1. You don't set anything. You add a simple linked field in the Phone table (not a many-to-many field). You can only select one member in a linked field therefore there can be only one member per phone. You said you wanted to ensure one member per phone, now you are saying you want to ensure one phone per member. Which one is it? I would presume that one person is allowed to buy/rent two phones if he wanted to.

2. You already asked this. The request makes no sense. You need to explain what it is you want to do.
malkyE
Posts: 21
Joined: Thu Apr 08, 2010 10:50 am

Re: tables - linkes

Post by malkyE »

HI,

We Want one phone to each member,
each member having one phone only.

How i limit it?
After I coose a member to a phone I don't want to see that member again in the list (for coosing another meber to a phone).

Thanks,

Malky.
ZevToledano
Posts: 722
Joined: Fri Apr 03, 2009 2:29 pm

Re: tables - linkes

Post by ZevToledano »

OK so if you ALSO want to restrict each member to one phone, then you'll need to be able to set a Unique Index on the linked field. I made this possible for the next version only (8.7.27).

Regarding restricting which values appear in the drop-down: You will need to setup an autofill automation event (autofill dropdown action) that runs a query that returns only members that don't have a phone assigned to them.
malkyE
Posts: 21
Joined: Thu Apr 08, 2010 10:50 am

Re: tables - linkes

Post by malkyE »

Hi,

I'm creating a tabels for our inventory,

We are having few type of thing in our inventory,

For each object (phones, earphones, bettery etc.) I want to creat a separate table,

Can I do one table that will take care of all the inventories?
That mean can I do a coulmn that link to more then one table?
(that in that cloumn I can couse an object from the phone table or from the beterry table etc. )

Thanks,

Malky.
ZevToledano
Posts: 722
Joined: Fri Apr 03, 2009 2:29 pm

Re: tables - linkes

Post by ZevToledano »

No this is not possible. A linked field can only link to one table.

The way this is usually done is you use a single table and put a field in that table that says what type of product it is.
Post Reply