Adding data from another table

Hi Clarion family.

I have 2 questions.

How can I update a table eg. orders table from another table’s records. eg. products.
I want to pull in data from products.an item which was ordered by a client

Secondly. On another application how cam I add an auto numbering field to an existing database.

Hope my questions are clear

Many thanks.

You just fetch() the appropriate row from the table and assign the fields. If it’s on a form and you’re using an entry field for the product code have a look at the actions for the control.

The autonumbering done by clarion is contrlled by a key. Just define a key with the fields needed

Thanks so much Sean. You are a star

Hi Sean
I checked out the autonumbering in clarion and noticed that it only works in new records that are added to the database. I am asking if there is a way to add autonumbering numbers to existing data.

Many Thanks Sean

Hi Tony - is this tps or SQL?

you may need to number the new field yourself on the existing records. Do you have FM3? I think it allows you to set SetIfNew to AutoNumber for tps files etc.

Hi Tony,

If you have FM3 (https://www.capesoft.com/accessories/FM3sp.htm) then you can use the AutoNumber Property.

To prime an autonumber field
AutoUP can automatically prime a new autonumber field for you. It will start at 1 and increment by 1 for each record.
Property Clarion 8 Property Description Value
SetIfNew Default value of the field when added to the table AutoNumber
Note: SetIfNew AutoNumber is not supported in SQL. Check out AutoNumber (https://www.capesoft.com/docs/fm3/fm3.htm#duoAutoNumber) in the Dictionary User Options for more details.

Hi GeoffThanks for your email. I am using TPS

Many thanks

For existing data you will need to create a procedure to alter the existing data.
I assume you mean you want to add a new field that you want to autonumber?
If so, and since you’re using TPS you will need to create a conversion program anyway. Assuming you use ABC methods, the copy from the old to the new converted file layout will autonumber for you.
That effectively what FM3 does as well.