PDA

View Full Version : No set Field Rules


ABC123

Dick Anderson
05-20-2006, 11:41 PM
I created a complex application in 1993 using Alpha Four (A4). Because of A4’s field rules for sets I was able to produce the application quickly without programming. I did have to write a lot of expressions.

Now I’m trying to reproduce the application using Alpha Five (A5) without field rules for sets. I don’t know where to begin. I can design the tables, sets and forms; write expressions for a database that would work fine but the data entry is clunky. Let me explain.

I have a Work Order entry form with parent table Work Order and three linked child tables, Shipping Customer, Billing Customer and Contact.

When entering a new Billing Customer I would like to get default values from Shipping Customer which can be accepted or over type. Also before this Work Order record is saved I want to auto fill Billing_ID and Contact_ID to the appropriate fields in Shipping Customer to be default values for the next time this Shipping Customer is used.

Once this Work Order is saved you should not be able to enter it except in the change mode where you can change the Shipping, Billing or Contact but you may not change Shipping, Billing or Contact particulars.

In A4 I used default expressions and skip expressions at Set Field Rules to accomplish the above actions.

Can anybody lead me in the right direction?

Tom Cone Jr
05-21-2006, 08:28 AM
Dick,

In Alpha Five data entry occurs through tables, not sets. In your set based form you will need to enter the parent table record first.

The default value field rule could be used in both shipping and billing tables to suggest an ID and Contact field values, using an expression that incorporates either the lookup() or lookupc() functions. These will automatically lookup a record, based on filtering criteria you supply, and return the field value you want.

People have built amazingly sophisticated apps using Alpha Four. Often they come to Alpha Five and assume they should be able to replicate the entire app easily here. Typically the conversion of the A4 app is their very first A5 database. This is often a mistake. Windows is not DOS. Things work very differently here. I recommend you start small. Build a simple one table form and figure out how to control data entry through it. Learn how Alpha Five's default behaviors work. Learn how to alter them. Learn how to modify the properties of field objects in your form layout. Learn how the event driven paradigm (sp?) works. Learn how to open other forms, prepositioned to specific records. Learn how to open and run reports. Learn the difference in filtering the set first, and then calling the report based on the "currently selected records", and leaving the set unfiltered, but filtering the report at print time. I think your conversion will be much less frustrating and will have a higher probability of success if you wait to work on it until you are thoroughly familiar with how Alpha Five's design tools work.

--tom

Dick Anderson
06-10-2006, 10:03 PM
Dick,

In Alpha Five data entry occurs through tables, not sets. In your set based form you will need to enter the parent table record first.

The default value field rule could be used in both shipping and billing tables to suggest an ID and Contact field values, using an expression that incorporates either the lookup() or lookupc() functions. These will automatically lookup a record, based on filtering criteria you supply, and return the field value you want.

People have built amazingly sophisticated apps using Alpha Four. Often they come to Alpha Five and assume they should be able to replicate the entire app easily here. Typically the conversion of the A4 app is their very first A5 database. This is often a mistake. Windows is not DOS. Things work very differently here. I recommend you start small. Build a simple one table form and figure out how to control data entry through it. Learn how Alpha Five's default behaviors work. Learn how to alter them. Learn how to modify the properties of field objects in your form layout. Learn how the event driven paradigm (sp?) works. Learn how to open other forms, prepositioned to specific records. Learn how to open and run reports. Learn the difference in filtering the set first, and then calling the report based on the "currently selected records", and leaving the set unfiltered, but filtering the report at print time. I think your conversion will be much less frustrating and will have a higher probability of success if you wait to work on it until you are thoroughly familiar with how Alpha Five's design tools work.

--tom


I used lookupc() in the field rules for default values. The expession gave me the right values but I didn't get anything in actual operation. The expression builder didn't offer the source table for looked up data so I typed in the table followed by a dash and the greater symbol (->). I know I'm not doing it right.

Dick

Tom Cone Jr
06-11-2006, 07:40 AM
Dick, if you attach a working copy of the sample database you're working on, we can look over your shoulder and offer advice. If you opt to do this, please give us specific instructions to follow in order to see the problem, and a specific description of the behavior you're striving for. --- tom

Stan Mathews
06-11-2006, 01:28 PM
I used lookupc() in the field rules for default values. There is more than one type of default value (Simple and Conditional) so you would have to tell us which one you used. Also you can specify when the default value is set during actual entry so
I didn't get anything in actual operation. doesn't tell us much.


The expression builder didn't offer the source table for looked up data so I typed in the table followed by a dash and the greater symbol (->).
Dick if you study the example of lookupc() in the documentation

tn = table.filename_get("customer")
lookupc("F", CUST_ID, "LAST_NAME", tn, "CUSTOMER_ID")

you will notice that -> is not used in a table specification.

At least show us the lookupc() expression you tried if you don't follow Tom's advice.

Dick Anderson
06-16-2006, 07:08 PM
At least show us the lookupc() expression you tried if you don't follow Tom's advice.

I entered this expression.

Order.Set Field Rules
B_Cust->B_NAME
Data Entry
Simple default expression
LOOKUPC(“F”,ORDER->SHIP_ID,”S_NAME”,”S_CUST”,”Ship_Id”)
Expression Builder
Result: is O.K. record-to-record


Alphafive created the following expression.

B_Cust.dbf Field Rules
B_Cust->B_NAME
Data Entry
Simple default expression
LOOKUPC(“F”,Lookup(“Order”,“Bill_ID=“+chr(34)+BILL_ID+chr(34),
“SHIP_ID“),”S_NAME”,”S_CUST”,”Ship_Id”)
Expression Builder
Result: is O.K. record-to-record

If I am supposed to attach my application; I'll need detailed instructions on how to do that.

Thank you

Dick

Tom Cone Jr
06-17-2006, 07:34 AM
There are no "set" field rules. As mentioned earlier you must define them in the table. When you edit field rules from the set, you're really editing them in each table, separately. This means that in a child table the field rule editor does not know about the links to the parent table.

Once your database is zipped you can attach it to a reply here. I use the quick reply link, and then click the "go advanced" button. This leads to a page where I can continue editing my message, while additonal options are presented below the text editor, including one to attach files (Manage Attachments).

what files do I send is a common question. For beginners it's best to send everything. You may want to copy your database to a temporary folder, open it there, and then delete most of the data. Don't delete it all or we won't be able to use it easily. Remember that what you post here is public, so if privacy is an issue edit your data to remove or scramble things you would not want others to see.

-- tom

Dick Anderson
06-17-2006, 11:34 AM
11622

Tom Cone Jr
06-17-2006, 03:48 PM
Dick,

I took a look at your database. Here are some suggestions and ideas for you.

1) Rename your set. Windows is very particular about names. It's important to use unique names for the different components of your database. Here you have both a table and a set with the same name.

2) Your set consists of a parent table, and three child tables each of which has a one to one link to the parent. You're trying to establish default field values for the billing and contact children, using the Shipping table as source for a lookup() or lookupc() default field value expression. I recommend against this approach. Field rules should be developed that will work for the table regardless of the context in which records are being entered or edited. If you eventually succeed in developing your approach it will only work if data entry will ALWAYS occur through your set, and then only if the user supplies the Shipping record first. A better approach would be to remove the default value field rules, and put a button on your data entry form. The button would simply copy (assign) the shipping field values to the Billing fields. An example of this is found in the Customer Information form in the AlphaSports sample database (though it uses a checkbox instead of a button).

I'll continue monitoring this thread to see if others different or better ideas for you.

-- tom