楼主
大 中
小 发表于 2006-10-17 17:25 只看该作者
Is it possible to copy values from one field into another field?
| Problem | | Is it possible to copy values from one field into another field? | | | | | | | Solution | QUESTION: Is it possible to copy values from one field into another field?
ANSWER:
Yes. This example shows how to copy values of a multiline_string field (Field A) into a short_string field (Field B) so that it can be displayed in a query.
The following steps outline the procedure in detail:
- Make backups of all databases, including the master schema repository (so they are all in synch with each other).
- Make a new field, field B (or any name of your choice), of type short_string with 254 characters. You can make the field of any length. In this example, I am making it 254 so that I have a large enough field to bring over values from a multiline_sting field.
** Make sure that the length of your field is large enough to accommodate the values being brought over. If you have a multiline_string field with a large amount of data, all of the data will not be able to be brought over. You will get an error message saying that field B has invalid values because the limit is 254 characters.
- Put this new field, field B, on the form.
- Add this script in the Initialization column of the Modify action (in defect record type)....
Dim newbie
newbie = GetFieldValue("A").GetValue
SetFieldValue "B", newbie
** This will create a temp variable called newbie. It will get the value of the original field, A, and put it in the new field, B.
- Test this in a test database before doing it in the production database!
- Run a query to grab all of the defects.
- Up in the query result set, hold down the control button and select all defects. Now they all show up highlighted in black.
- Do a mass modify. With all records selected, go to the first record and do Actions > Modify.
- A dialog box titled "Multiple Record Update" will pop up. The first question asks if the changes made to the first record are to be applied to all. Say yes. If you do not want this change to affect all of the defects, you should create a query of only the desired records. The second question asks if you want to see each record before committing the changes. Answer this accordingly and then hit OK.
- Now you will see the records being changed. There isn't a need to change anything else in the records. Only do Actions > Modify (because the hook to change it is on the initialization of the modify action).
- Once it goes through ALL of the records, hit apply.
- View each record and to see that the values in field A are now brought over to the new field, field B.
- Now, do the above to the production database.
** It is good to run through it once first in the test database to be familiar with the procedure and see how it works.
- After making the changes to the production database, you can now delete the original field, field A, off the form. Now, none of the users will see the old field. It can remain in the fields grid of Designer if you want.
- After making all of these changes, you can remove the hook because records submitted from now on will not have the original field on the form for users to put data into. They will now use the new field. | | |
搜索更多相关主题的帖子:
field possible values one
© 本文为 懂你 与 SCMLife 共同所有,未经同意,请勿转载 ©如该文侵犯了您的版权,请联系 管理员。
优惠购买Rational,Telelogic,Hansky产品,企业VIP服务、实施
VIP服务电话:13581809377
|