About exporting auto-tool in object libraries

Build 1501 on 14/Nov/2017  This topic last edited on: 28/Sep/2016, at 10:44

The GN3 library objects with auto-tool may contain IDs of GN3 formats and types.

When you export GN3 formats and import them in GN4, they will not keep the same IDs. It is actually impossible to achieve, because of huge differences betwen GN4 and GN3 data and database structure.

Therefore, you will have to adjust all the exported library objects with format auto-tool to the GN4-related format IDs before importing them in GN4.

This is one-time job, but you have to carry it on for each object library separately.

Adjusting IDs

To adjust IDs, first create a text document, entering in it all the GN3 formats IDs and type IDs (use the GN3MMC to read them), and then adding to such data the GN4 formats IDs, imported from GN3 (use EdAdmin4 to read them). You will later use this text document to replace GN3 formats IDs with GN4 formats IDs. To get the type ids in GN4, the procedure is a bit more complicated: run the following SQL query from the SQL Management Studio:

SELECT TOP 1000 [gn_Id]

    ,[gn_Name]

    ,[s_nameptt]

    ,[s_description]

FROM [GN4].[dbo].[gn_ObjectTypeTable] where s_nameptt != ''

 

The results will be something as the following screenshot, where you get all GN4 IDs of the element types:

exporttypeids

Example

GN3 format ID

GN3 type ID

GN4 format ID

GN4 type ID

1234

2345

3456

5678

...

...

...

...

Replacing the IDs

Open the exported XML of library objects in Notepad++, and then search for all occurrences of the ContextId=" in the current document. This will produce the list of related lines in the bottom pane:

Click to toggle graphic size

Do the following:

Find all occurrences of ContextId="1" TypeId="1" and replace with ContextId="0" TypeId="0". This adjusts the lines that are referring objects different then text frames and images.

Find all occurrences of ContextId="1" where TypeID is not "1", and replace with NewContextId="<id_of_J_format>" NewTypeId="<id_of_GN4_type>". This adjusts the lines that are referring objects text frames and images, but the GN3 format was J.

Find all occurrences where ContextID is not "1" and TypeID is not "1", and replace with NewContextId="<id_of_GN4_format>" NewTypeId="<id_of_GN4_type>". This adjusts the remaining lines.

Find all occurrences of NewContextID and NewTypeID, and replace with ContextId and TypeId.

Now, import, or reimport the object library.