How to set a field as a primary key?

Hi All,

I have a database where users create documents against a Form called ‘DETA’

This Form collects daily sales values in different sectors.

This Form has a Date/Time type field as CDATE(not displaying time), which actually I would like to see performing as a primary key.

I just don’t want let anyone to create 2 documents with same CDATE field value.

I would like to display an error message if someone tried to save a document with repeated CDATE value as “ There is a document saved to this Date, check the Date Pls”

How I could incorporate this feature to my application pls?

Thanks in Advance

Mira

Subject: How to set a field as a primary key??

Dear Mira,

I think there is no such key concept in notes.

You have to code to verify the user input.

Hope it helps, others may have a better solution.

Regards,

Yusuf

Subject: RE: How to set a field as a primary key??

Well Thanks, How do I code it pls? Can someone help??Do I have to search through all created documents, before saving a new one? I think that’s the logic, any ideas??

Subject: RE: How to set a field as a primary key??

Hope this helps:

  1. Create a view with your CDATE as the first column, set it as categorised

  2. Use formula to check if the data exist

list:=@dblookup (“”:“”;“”:“”;“Viewname”;Cdate;1)

If list is not “” then data already exist, and you can prompt user for error.

  1. Alternatively, you can use agent or javacsript to validate

Rgds

Rusinni

Subject: How to set a field as a primary key??

Mira, do you consider your CDATE field to be date only? If so, then that would mean that you only want one document per day to be created in the database. (If user A created a document using that DETA form in the database on Monday, then based on what it seems like you are saying, no other user would be permitted to create any documents that day using that form.) Is that correct?

Subject: RE: How to set a field as a primary key??

Hi Jerry,

It is something like this, there are few users input sales values using this database.

They can create documents anytime, but I just want to stop repeating documents which has same date field value.

Anyway I am just going to check list option proposed by earlier member…

Thanks everybody.

Cheers

Mira