RE:Unwanted data in new record
Following is an "off board" conversation, posted here at the request of Al Buchholz, as info for anyone who is interested. Read from the bottom towards the top.
===================
Al..
Q...I want to use my own expression because I want the record number to be created once only...at record creation. Then it must not increment at future revisions. The auto increment will alter it every time.
A...That's not true. It makes the value when the record is created and leaves it as that value even when a record is updated.
Q...The strange thing is that the expression works fine, so long as you close the current record before trying to create a new one. The system did not warn me not to do it that way...I only got warnings when I stripped the IF expression away from the MAXIMUM statement.
A...It told me that the expression shouldn't be used.
===================
I will try the "events" route, also look at the suggestions on the site.
Also...when I am satisfied with the thing, I will post it to the site.
Paul S..
==================================
At 07:43 AM 2/26/2005 -0600, you wrote:
Paul
Or it's using a function that's not designed to be used there.
Why do you want to write your own expression when the autoincrement does what you want?
I believe it when the system tells you not to use a function in that context, you probably better not use it there.
There are some examples of alternatives to the autoincrement choice for those who need it. Some are posted on the message board, others are at http://www.learn alpha.com
Most involve coding applied at the cansave event of the field rules. Those events are found on the events tab of the field rules along with choosing the record events within that tab.
I don't think you're going to convince anyone that this situation is a bug. The system in fact told you not to do it that way. The only thing it didn't do is give you an alternative.
To keep the message board effective, please post your results so others can gain from that experience.
regards
alb
==========================
At 12:06 AM 2/26/2005, you wrote:
Al..
This gets wierd. I think the word for it is a bug.
I did the things you suggested, and it stopped misbehaving!
So...I put everything back the way it was, one step at a time (to find out what the problem was), and the problem re-occurred when I rebuilt the calculated field expression for RECNBR (was RECNO).
The expression is IF(RECNBR"0,RECNBR,MAXIMUM(RECNBR)+1) This creates a record number by adding one to the highest existing RECNBR, but only if it is empty.
The expression evaluates correctly, but also causes the problem. I tried it with a dummy IF(1=1,2,3) statement which works fine, and causes no problem, and it appears that it is the MAXIMUM argument that bombs it. If I put the MAXIMUM statement in by itself...ie: not inside an IF( ) statement, the field rules system will not allow it...says "cannot use in this context".
Paul S..
===========================
0600, you wrote:
Paul
I'm not getting it to do what you said.
Are you on the latest patch? Check help - about Alpha and let me know the two numbers that are there.
There is also a help - check for new version.
I do get a problem in the field rules with the recno field.
I'm thinking that you're fighting the system too much.
Use an autoincrement field and don't name it recno. Call it record_id or something else.
Make create_date an user entered field, with a default value of date() and a skip of .t.
Make the rev_date a calculated field - date() with a skip of .t.
I think that'll make your problems go away.
Let me know if that helps.
alb
===========================
At 05:59 PM 2/24/2005, you wrote:
Sorreeee...forgot the attach file!!!
===========================
Al..
Thanx for your interest. I have attached the zipfile of the experimental database I was having trouble with. It is a collection of addresses.
In case you are wondering, they are all real addresses from my Xmas card list...there really is a Puddleduck Cottage in Stubb Rd. in Hickling.
If you select the default form, do nothing else except click on "new record" button/icon, and you will get a new record, the new record will contain the data from the record with the highlighted field.
I have cleared all but one field rule, and I don't think that has anything to do with anything.
Regards
Paul Simison..
nnnn
Following is an "off board" conversation, posted here at the request of Al Buchholz, as info for anyone who is interested. Read from the bottom towards the top.
===================
Al..
Q...I want to use my own expression because I want the record number to be created once only...at record creation. Then it must not increment at future revisions. The auto increment will alter it every time.
A...That's not true. It makes the value when the record is created and leaves it as that value even when a record is updated.
Q...The strange thing is that the expression works fine, so long as you close the current record before trying to create a new one. The system did not warn me not to do it that way...I only got warnings when I stripped the IF expression away from the MAXIMUM statement.
A...It told me that the expression shouldn't be used.
===================
I will try the "events" route, also look at the suggestions on the site.
Also...when I am satisfied with the thing, I will post it to the site.
Paul S..
==================================
At 07:43 AM 2/26/2005 -0600, you wrote:
Paul
Or it's using a function that's not designed to be used there.
Why do you want to write your own expression when the autoincrement does what you want?
I believe it when the system tells you not to use a function in that context, you probably better not use it there.
There are some examples of alternatives to the autoincrement choice for those who need it. Some are posted on the message board, others are at http://www.learn alpha.com
Most involve coding applied at the cansave event of the field rules. Those events are found on the events tab of the field rules along with choosing the record events within that tab.
I don't think you're going to convince anyone that this situation is a bug. The system in fact told you not to do it that way. The only thing it didn't do is give you an alternative.
To keep the message board effective, please post your results so others can gain from that experience.
regards
alb
==========================
At 12:06 AM 2/26/2005, you wrote:
Al..
This gets wierd. I think the word for it is a bug.
I did the things you suggested, and it stopped misbehaving!
So...I put everything back the way it was, one step at a time (to find out what the problem was), and the problem re-occurred when I rebuilt the calculated field expression for RECNBR (was RECNO).
The expression is IF(RECNBR"0,RECNBR,MAXIMUM(RECNBR)+1) This creates a record number by adding one to the highest existing RECNBR, but only if it is empty.
The expression evaluates correctly, but also causes the problem. I tried it with a dummy IF(1=1,2,3) statement which works fine, and causes no problem, and it appears that it is the MAXIMUM argument that bombs it. If I put the MAXIMUM statement in by itself...ie: not inside an IF( ) statement, the field rules system will not allow it...says "cannot use in this context".
Paul S..
===========================
0600, you wrote:
Paul
I'm not getting it to do what you said.
Are you on the latest patch? Check help - about Alpha and let me know the two numbers that are there.
There is also a help - check for new version.
I do get a problem in the field rules with the recno field.
I'm thinking that you're fighting the system too much.
Use an autoincrement field and don't name it recno. Call it record_id or something else.
Make create_date an user entered field, with a default value of date() and a skip of .t.
Make the rev_date a calculated field - date() with a skip of .t.
I think that'll make your problems go away.
Let me know if that helps.
alb
===========================
At 05:59 PM 2/24/2005, you wrote:
Sorreeee...forgot the attach file!!!
===========================
Al..
Thanx for your interest. I have attached the zipfile of the experimental database I was having trouble with. It is a collection of addresses.
In case you are wondering, they are all real addresses from my Xmas card list...there really is a Puddleduck Cottage in Stubb Rd. in Hickling.
If you select the default form, do nothing else except click on "new record" button/icon, and you will get a new record, the new record will contain the data from the record with the highlighted field.
I have cleared all but one field rule, and I don't think that has anything to do with anything.
Regards
Paul Simison..
nnnn
Comment