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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Field Values

Status
Not open for further replies.

dblarch

Technical User
Mar 8, 2004
29
0
0
US
I have a field in a table which contains a list of integers used as IDs. I'd like to offset them by a fixed amount as follows: 1->201, 2->202, 3->203, etc. Is this possible in a live query? If not is there some code that will accomplish the task?

Thanks,

DblArch
 
var
qbe query
endvar

qbe=query

tablename.db | fieldname |
| _a, changeto _a+200 |

endquery
qbe.executeqbe()

If the table is keyed, you might want to remove the key first. But the above should work either way.

Tony McGuire
 
Thanks Tony,

Paradox 10 Help alludes to "CHANGETO" but offers no example of the straightforward and quite helpful query you supplied which was perfectly suited to my problem. The "_a" in your query has the same form as the join string used when querying on two or more tables linked by a common field. Does this string arrangement have even more uses?

Thanks again,

DblArch
 
Example Elements are simply a way to reference a field.

You can 'join' tables with them, and you can use them to reference fields in the same table, or different tables, in the query.

They are helpful for selecting things based on a field, as well as performing calculations.

Or, as in this case, to reference a field to be changed as well as a reference of the calculation to perform.

A couple of examples:

query

tablename.db | fieldOne | fieldTwo |
| _a | changeto _a+200 |

endquery

query

tablename.db | fieldOne | fieldTwo |
| _a | _b, changeto _a+_b |

endquery


Tony McGuire
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top