How to stop inserting new record in tabular form based on specific condition [message #387670] |
Fri, 20 February 2009 04:19 |
sindikalac
Messages: 52 Registered: November 2008 Location: Europe
|
Member |
|
|
Hi
I have problem like this.
I have a data block, tabular form based on that data block with two fields:
ID and DATE. It's like a list of dates in a form.
I would like to stop inserting new record before the DATE field of the previous record is written.
For instance, I have situation like this:
ID DATE
1 10.10.2009
2 11.10.2009
3
Now when I want to insert a new record:
ID 4 with new DATE,
I would like to stop it, because in record 3 you must first insert the date, then you can insert record 4.
I hope I you understand my English.
|
|
|
|
Re: How to stop inserting new record in tabular form based on specific condition [message #387708 is a reply to message #387682] |
Fri, 20 February 2009 06:12 |
sindikalac
Messages: 52 Registered: November 2008 Location: Europe
|
Member |
|
|
I forgot to say that I can't use Required because, I cannot insert date in the same time when I am inserting ID. When I get information that a job is finished I insert date for that ID (ID is for job, date is when it's finished), after that I can insert new record with new ID, but I have to wait for the information about the date. New record (job) can be inserted just when the previous job is finished meaning that the date of previous record is inserted.
[Updated on: Fri, 20 February 2009 06:16] Report message to a moderator
|
|
|
|
|
Re: How to stop inserting new record in tabular form based on specific condition [message #387733 is a reply to message #387725] |
Fri, 20 February 2009 07:30 |
sindikalac
Messages: 52 Registered: November 2008 Location: Europe
|
Member |
|
|
To answer the question:
That job means what you said "we have created a job ID = 1 which means that today someone began to dig a hole and it will take 2-3 days" so you'll enter date once the man digs the hole (which depends on weather conditions, whether there are rocks there, etc.). So, I have to enter ID and date separately.
I am now going to try what you suggested in WHEN-CREATE-RECORD, and I'll be back.
|
|
|
Re: How to stop inserting new record in tabular form based on specific condition [message #387751 is a reply to message #387733] |
Fri, 20 February 2009 08:22 |
sindikalac
Messages: 52 Registered: November 2008 Location: Europe
|
Member |
|
|
It generally works fine, but is there any other trigger which I could use because there is more to the story.
I move to the tabular form from main tabular form clicking a button after I position to the name of a person. Then I click a button and open a tabular form with the jobs (related to that person) i.e. I have two data blocks, the second one is the one we talked about. In the first block I have names of the people. When I create trigger and place it in the second data block, and when I start a form, trigger fires every time before I can even click a button to move the "job" form.
My problem is now, how to pass a name of a person I chose with the mouse to the second tabular form where I created WHEN-CREATE-RECORD.
For instance
On the first tabular form I have list of names and buttons for each name:
Name
Joe Button
Ivan Button
Ericson Button
etc.
I chose for instance Ivan and click Button and I move to the second data block (i.e. tabular form with the jobs).
In order to do select from your code I need to pass name to a trigger. I tried with global variables like this:
I put select statement in WHEN-BUTTON-PRESSED under button:
select count(*) into :global.l_cnt
from tables
where ... and field=:name;
I created WHEN-CREATE-RECORD in the second data block with the rest of your code adding just Erase('global.l_cnt');
and I declared global varibale in PRE-FORM (form level):
:global.l_cnt:=0
Problem with this is it seems to work, but when I move from one canvas to another few times, it generates strange messages.
|
|
|