Solved

Prevent duplicate project number

Posted on 2007-11-16
7
189 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
  • 3
  • 2
  • 2
7 Comments
 
LVL 63

Expert Comment

by:SysExpert
Comment Utility
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
Comment Utility
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
Comment Utility
In the validation I would think. If it exists already, popup a message.


0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:kali958
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now