PDA

View Full Version : Synchronizing custom item templates between different DB files


smitchell
10-28-2022, 01:34 PM
Hi-

One of my applications of UR creates separate urd files, starting from a skeleton file and then doing "Save As." The database files contain 10-20 custom forms and item templates with many custom attributes. This system has evolved over the years, so some of the earlier urd files are different than the current skeleton file. The changes are mainly to the forms and attributes, but the collection of item templates has not changed much.

What is the recommended strategy for keeping the structure of these files in sync? That is, how do I keep the attributes, forms, and item templates compatible? Is there a way to do a "diff" between two urd files, to see where their attributes, forms, and item templates are different?

One technique I have experimented with is "drag & drop" of an item template between databases. This does not appear to update the attributes or forms of the target database. In fact, this has made me wonder how items derived from a custom template transfer to a different database via "drap & drop." Do both databases have to have the same item template name or do they have to have matching attributes?

Any ideas & suggestions are welcome!

-Stan

kinook
11-01-2022, 01:10 PM
There is not a diff feature in UR.

If you create a template item with custom attributes and a form, and copy the template or an item of that template to another DB, the custom attributes and form will also be created in the destination DB.

If you then modify the template and add more attributes, and copy the template or item of that template to the same DB as before, UR will add any additional attributes in the destination, but it won't modify the form or existing items with additional item attributes. But you could search for all items of that template, select all, and add the missing item attributes (and also add them to the form).

smitchell
11-01-2022, 03:14 PM
If you create a template item with custom attributes and a form, and copy the template or an item of that template to another DB, the custom attributes and form will also be created in the destination DB.


I tried creating a default database to which I copied one of my custom templates.
This is the custom template in the source database:

1402

Two attributes of this template are custom: Hours (string) and Holdings (string); the rest are "built-in" attributes.
After copying this template item to the template folder of the default db it displays like this:

1403

A repository Form is created but it does not have the Hours and Holdings attributes,
although lines have been reserved for them.

1404

Also, the Attributes list does not contain Hours and Holdings.
I used the Edit menu's Copy and Paste commands.
Do I need to use a different procedure?

Thanks for your help.

kinook
11-05-2022, 07:05 PM
In my earlier test, I copied an item of the template, rather than the template item itself, but I tried that just now and also got the expected result.

smitchell
11-07-2022, 02:05 PM
Thank you for taking a look at this.
I tried your sample and I found it works as you describe.

To try to isolate the problem I am experiencing, I created a separate database with a custom Repository item type (as described in my previous post)
and created two Repository items -- it is Repository-Sample.urd in the attached Zip file.

For one of the Repository items, all Attributes are populated, for the "unpopulated" item, it only has an Item Title.

I tried three tests:

Case 1 - Copy fully-populated Repository item to Root of a new default db.
Case 2 - Copy Repository Item template to Templates folder of a new default db.
Case 3 - Copy unpopulated Repository item to Root of a new default db.


The results that I see are:

Case 1 - works as expected, form, attributes, and template are correct.
Case 2 - custom attribs are not copied, form&template are missing custom attribs.
Case 3 - custom attribs are not copied, form&template are missing custom attribs.


These resulting databases are included in the zip file and are named CaseN....urd.

It appears that a new Item type is not completely copied to a different database if any of its attributes are not assigned values.

This is a fairly simple case. I wonder how a template Item type that contains references to other InfoItem types will transfer to a new database.

Thanks,
-Stan

kinook
11-13-2022, 06:50 PM
They don't need to have a value, but the template item does need to have the custom item attribute(s). The mere existence of an attribute on a form will not bring the attribute over.

smitchell
11-15-2022, 01:54 PM
They don't need to have a value, but the template item does need to have the custom item attribute(s). The mere existence of an attribute on a form will not bring the attribute over.

Thank you -- that is what I was missing.

My approach has been to create forms with custom attributes. Then in the template item, I just give the name of the form used. I assumed the attributes were pulled into the new type. This worked until I tried copying items between databases. Maybe it has had other consequences that I'm not aware of.