Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is this the "best" way? 1

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
I have a program that users use to conduct interviews. The most used form in the program is the interview form. This form will need to be opened in a variety of ways with a variety of information.

For instance, if the user is creating a new interview then I need to know if it is for one of our cases or for another court's cases. If it's for one of our cases, I need to run a query that gathers basic information and fill in a few questions. If it's for the other court, I don't need to fill in anything except the user, date and time.

Once the interview has been started, it may be paused while information is confirmed. Other interviews will be in progress at this time (so I need the capability to have multiple copies of the same form open with different information)

If the user is opening a completed or in progress interview, I will need to run a different query that gathers all the previously entered information and fill it in.

My original approach was something like this:

on main form, user selects 'New Interview':

Code:
procedure TfBIMain.NewInterview1Click(Sender: TObject);
begin
  with TfInterview.Create(self) do
  begin
    booNewInterview := True;
    Show;
  end;
end;

when fInterview is shown:
Code:
procedure TfInterview.FormShow(Sender: TObject);
begin
  if booNewInterview then
    StartNew;
  else
    GetInterview(InterviewID);
end;

The StartNew procedure:
Code:
procedure TfInterview.StartNew();
begin
  [b]//calls fNewInterview[/b]
  fNewInterview.ShowModal;
  if not booDistrict then
  begin
    with dm_Interview.qryGetCaseInfo do
    begin
      ParamByName('CasePrefix').AsString := sCasePre;
      ParamByName('CaseNumber').AsString := sCaseNumber;
      Active := True;
      if not isempty then
      begin
        First;
        //fill in information
      end;
    end;
  end;
  lCaseNumber.Caption := sCasePre + sCaseNumber;
  lInterviewTimeStamp.caption := FormatDateTime('mm/dd/yyyy  hh:mm am/pm', Now());
  fNewInterview.Close;
end;

the fNewInterview form has an edit box to enter the case number and a check box to indicate if it's for our court or another and button to start the interview process:
Code:
procedure TfNewInterview.bBeginInterviewClick(Sender: TObject);
begin
  fInterview.booDistrict := cbDistrict.Checked;
  with dm_Interview.qryGetCaseInfo do
  begin
    fInterview.sCasePre := UpperCase(copy(eCaseNumber.Text, 1, 2));
    fInterview.sCaseNumber := copy(eCaseNumber.Text, 3, length(eCaseNumber.Text));
  end;
  Close;
end;

My problem is coming from the call to the NewInterview form. When the button is pressed after the user has entered the case number, the boolean value of booDistrict on the interview form isn't set.

So I need to be able to open an existing interview or a new interview. If it's a new interview I need to know if it's ours or theirs. When the main interview form closes I need all the information cleared out.

Am I approaching this the right way? Does anyone have any suggestions on how to make the program behave the way I need?

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases: The Fundamentals of Relational Database Design
 

Not sure I follow you completely, but I think I would use an MDI interface with a menu that provides for the four possible choices: New Ours, New Theirs, Existing Ours, Existing Theirs. (Also providing a tool bar with 4 speed buttons for quick access -- using an action list.)

Then for either "new" case, display the form for filling in.

For the "existing" case, display a form with everything disabled except for a text box to enter the case number (and a button to provide look-up capability if the number is not known) and a button to retrieve the data and enable the other fields on the form. After retrieval, there should be buttons (or menu choices) for save, save and close, and clear.

To allow for multiple instances, you can't use ShowModal, you have to Show.

 
I'll look into the MDI option and let you know how that works out. Not sure that I need multiple copies at the same time.

Here's the full deal (this is currently a Lotus Notes program that is being transformed to a Delphi application).

A person gets arrested either for a new charge or an outstanding warrant (the warrant can be from any court). Our Background Investigation department interviews the people who get arrested to see if they are eligible to bond out, released on their own recognizance or have to stay in jail to see a judge.

There are a bunch of questions geared toward work and address history, community ties, income source, education levels. All these questions are contained in the Interview form. (I have created some tables that will store the information collected in the Interview form.) When a new interview is started the user selects 'New Interview', at this point they enter in the case number and check if the case is from another court.

If the check box is not checked, then I need to run a query against our database using the Case Number entered to get the defendant's name, current address, DOB, SSN and the charges and fill in portions of the interview form. If the box is checked then I don't have to run that query.

Once the user has gotten answers to all the questions, I'll save that information in the tables and close the form.

After getting all the answers, the user must then verify the information given. They phone references, check address and employment and then decide if the defendant can be released. Once a decision has been made about the person's release the user needs to open the interview again and make the selections regarding release.

When the interview is opened at this point I need to run the query that will retrieve ALL the information about the interview.

Hopefully this will help you understand what I'm trying to accomplish.

Thanks!
 
Not sure that I need multiple copies at the same time.
Other interviews will be in progress at this time (so I need the capability to have multiple copies of the same form open with different information)
So which is it?

Before getting bogged down in a particular implementation (MDI v. non-MDI, Modal v. Non-Modal) it would be a good idea to work out the "interactivity" that is best suited for the application. (See The Art of Interactive Design by Chris Crawford) Essentially, that means describe the "dialog" between the user and the computer that allows the desired goals to be met.

Once the interactivity is specified, then the user interface design can begin. The difference between interactivity and interface is a bit subtle at first, but you can soon get the hang of it.

Interactivity - what do you want to do.
Interface - how do you want to do it.

In the post above, you have gotten the two intermingled. Generally, you have described the interactivity rather will, but by mentioning physical interface items (e.g., check box) you have made it sound more confusing than it needs to be. Try to focus on the interactivity and then decide whether a check box is needed.

Interactivity examples:
Example "A1" - other court
[tt]
User: I want to enter a new case
Computer: Ok, here is a blank form for you to use
User: The case is from another court
Computer: Ok, here is a blank form for you to use
[/tt]
Example "A2" - my court
[tt]
User: I want to enter a new case
Computer: Ok, here is a blank form for you to use
User: The case is from my court
Computer: Ok, what is the case number
User: the case number is xxxxxxx
Computer: Ok, here are the data for case number xxxxxxx
[/tt]
Example "B1" - other court
[tt]
User: I want to enter a new case from another court.
Computer: Ok, here is a blank form for you to use.
[/tt]
Example "B2" - my court
[tt]
User: I want to update data for a case from my court.
Computer: Ok, what is the case number
User: I don't know, give me a list of recent cases
Computer: Ok, here is a list. Select the one you want.
User: (Double clicks the case)
Computer: Ok, here is a form with the data we have so far.
[/tt]
 
you're right, i'm confused!

Let me think about it, talk with the user and decide what I need to do. I like your approach of interactivity. I'll look at those and see what I can come up with. Thanks for your help, I'll be back!

les
 
Thanks, I've been able to figure out what I need to do and how to do it! Your thoughts and suggestions were very helpful in doing that.

Les
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top