Solved

Prevent duplicate project number

Posted on 2007-11-16
7
198 Views
Last Modified: 2013-12-18
I have a database where the associates can look up to see what the last project number was on a project - this is per their specs. They wanted to be able to type in the number rather than have the database gen a UNID.  So is there a way that I can somehow have the database check to make sure that they did not type in a number that is already in use on another project?
0
Comment
Question by:kali958
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 20299920
SUre, just do a DB lookup on the view sorted by project numbers and see if it already exists.

I hope this helps !
0
 

Author Comment

by:kali958
ID: 20299991
Okay, dblookup for the field. Does that mean on the editable field where they type in the project number then in the validation have the lookup?  I just need some more clarity on this if DBlookup provides the solution.
0
 
LVL 63

Assisted Solution

by:SysExpert
SysExpert earned 150 total points
ID: 20301308
In the validation I would think. If it exists already, popup a message.


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kali958
ID: 20301358
Okay either it is cuz it is Friday or I just need a vacation, but here is an example of what I think you are suggesting:

Create a field, NUMBER for the tracking number in the document,

then in the validation put in the dblookup code something like @DbLookup("";"";"ALL_NUMBERS";Number;not sure what my key would be yet)

But my issue is how to I tell it to compare what is typed in the NUMBER field and what to lookup in the @DbLookup.
and then if they match there could be something like @If (Number = FoundNumber;@Failure("These Match, try again";@Success).

I am just lost on how to do the lookup and compare.
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 350 total points
ID: 20301453
check := @DbLookup("";"";"ALL_NUMBERS";Number);
@If(@IsError(check); @Success; @IsNewDoc; @Failure("Duplicate project ID #" + @Text(Number); @Success);

This assumed the project number field is named NUMBER
0
 

Author Comment

by:kali958
ID: 20301496
This is what I came up with

NotUnique := (@IsNewDoc & @IsMember(@Text(NUMBER);@DbColumn("":"NoCache";"":""; "ProjectNumbers"; 1)));

BlankField := Combo = NULL;

@If(NotUnique | BlankField;@Failure("The Project Number you supplied is not valid or blank. Please confirm that the field contains a unique value.");@Success)
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 20315010
Hmmm. If that works, great.  But it is more costly than @DbLookup, since @DbColkumn has to retrieve every row of the view.

Alos, there is a 64k limit to what @Db functions can return.  If you expect a LOT of documents in the view, you will blow the limit.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question