ToolKit Tag File

Discussion in 'C-Bus Toolkit and C-Gate Software' started by sjfp, Sep 1, 2010.

  1. sjfp

    sjfp

    Joined:
    Oct 31, 2004
    Messages:
    145
    Likes Received:
    1
    Location:
    UK
    I want create "As Built" documentation from a toolkit project file in c-gate TAGS.
    I wish to import the information into MS Access 2007. Is there any information around that would assist in this?
    We already have a Database System we use to produce custom records, which we manually enter the information. I want to now use the c-gate xml file to import automatically
     
    sjfp, Sep 1, 2010
    #1
  2. sjfp

    ashleigh Moderator

    Joined:
    Aug 4, 2004
    Messages:
    2,396
    Likes Received:
    26
    Location:
    Adelaide, South Australia
    Check the documentation buttons in Toolkit. Some create HTML as-built doco, and some will export CSV files that you can then import into other products.

    One of the TK gurus may wish to comment further - but my suggestion is to go an poke around in TK - there should be something there that gets you most of where you want to go.
     
    ashleigh, Sep 2, 2010
    #2
  3. sjfp

    daniel C-Busser Moderator

    Joined:
    Jul 26, 2004
    Messages:
    770
    Likes Received:
    21
    Location:
    Adelaide
    Hi sjfp,

    Access 2007 has the ability to import XML files. You can in fact import the C-Gate tag database just as it is, but the tables will not contain any relationship information - for example there will be a table with all the Applications and a table with all the Groups with no indication of which Groups belong to which Applications.

    To try and solve this for you I've attached a file called v22_eid_links.xslt (inside the zip file). [NOTE: see new version v22_eid_links_v2.xslt in later post] This is an XSLT transform which interprets a C-Gate tag database to generate relationships that a relational database (such as Access 2007) can use. This extra relationship information takes the form of what I'll call EIDs (External IDs) which are unique identifiers that can be used to link the tables together.

    Here is how to import the C-Gate tag database into Access 2007 with this transform:

    1. In Access 2007, create a blank database.

    2. Under the "External Data" ribbon, select "XML file"

    3. Choose your C-Gate tag database .XML file. Note that this process will not modify your tag database file, but you should work with a copy of it, just in case.

    4. You should see a dialog titled "Import XML" that lists several nodes such as "Interface", "Group", "TagDLT" etc. On the right side is a "Transform..." button. Click this button.

    5. You'll see a dialog titled "Import Transforms". Click on "Add" and select the v22_eid_links.xslt file I've provided. It'll appear in the list of available transforms. Select it in this list and click "OK".

    6. Back at the "Import XML" dialog, the nodes will have been updated to reflect a preview of the transform. You can confirm this by expanding the Group node to see the new attributes "EID" and "ApplicationEID". Similar attributes will have appeared on some of the other nodes too.

    7. Confirm that "Structure and Data" is selected. Click "OK" to perform the import.

    8. A new dialog appears titled "Get External Data - XML File". It confirms that the import is finished. Don't bother with saving the import steps. Just click "Close".

    9. You'll see the tables appear in Access 2007. The import is now finished. Proceed with the following steps to link the tables together in Access. This helps you to visualise how the data ties together.

    10. Under the "Database Tools" ribbon select "Relationships". This produces the "Show Tables" dialog.

    11. Hold down CTRL and select Application, Group, Level, Network, TagDLT and Unit. Click "Add".

    12. You'll now be in a Relationships view where you can set up relationships between the tables by dragging and dropping fields. See attached file "Relationships.jpg". EID is the unique key for each table, and fields such as NetworkEID, ApplicationEID etc are the foreign keys. Once you've set up these relationships Access will be able to understand the data.

    Note that you cannot rely on the OID fields, as these may or may not exist.

    Hope this helps!
     

    Attached Files:

    Last edited by a moderator: Sep 3, 2010
    daniel, Sep 2, 2010
    #3
  4. sjfp

    sjfp

    Joined:
    Oct 31, 2004
    Messages:
    145
    Likes Received:
    1
    Location:
    UK
    thanks, will give it a try tonight and will let you know how it go's.
     
    sjfp, Sep 2, 2010
    #4
  5. sjfp

    sjfp

    Joined:
    Oct 31, 2004
    Messages:
    145
    Likes Received:
    1
    Location:
    UK
    Daniel, I have been looking at the process, but i can't see a relationship between units and groups. How do if find out what groups have been used in what unit.
    The database we use currentley gives us schedules of each unit on the network and what groups are used within that unit. so for a relay we can see what groups are allocated to each channel and also what units control that channel.
    Thanks for what you have done so far.
     
    sjfp, Sep 2, 2010
    #5
  6. sjfp

    daniel C-Busser Moderator

    Joined:
    Jul 26, 2004
    Messages:
    770
    Likes Received:
    21
    Location:
    Adelaide
    Hi sjfp,

    Attached is v22_eid_links_v2.xslt, used in exactly the same way as described before. This version introduces a new table called PP which stores each unit's properties.

    NOTE: When doing the import into Access 2007, you may get a message about an ImportErrors table being created with messages about Field truncation in the PP table. This is because a small handful of the PP values (particularly those containing Scenes, or data for PC_GIM) are longer than 255 characters. This probably won't affect you as the fields you're interested in are much shorter. But if you do want to preserve these values; first perform a "Structure Only" import into Access, edit the PP table and change the datatype for the Values field from text to Memo, then repeat the import with the "Append to Existing Tables" option.


    Now this is where you're on your own I'm afraid, because the group addresses take a bit of figuring out and are stored in all kinds of places. However, as a general rule:

    Application = 0x38 0xff
    These are the primary and secondary applications. Some units don't use secondary.

    GroupAddress = 0xe8 0xe7 0xe6 0xea 0xeb 0xe1 0xe9 0xec 0xee 0xf0 0xed 0xef 0xc9 0xff 0xff 0xff
    These are the groups on each block or channel. Eg. for a RELDN12 there's 12 channel groups followed by 4 logic groups.

    SecondApplicationBlocks = 0x2
    For units supporting secondary application, this bitmask tells you which of the GroupAddress values are on the secondary application, as seen in the Application column on the Blocks tab for the unit in Toolkit.

    BlockAllocation = 0x1 0x2 0x4 0x8 0x10 0x20 0x40 0x80
    For input units these bitmasks represent the mapping of each block to keys, as seen in the "Keys using Block" grid on the Blocks tab for the unit in Toolkit.

    Hope this gets you further on your way to data integration.
     

    Attached Files:

    Last edited by a moderator: Sep 3, 2010
    daniel, Sep 3, 2010
    #6
  7. sjfp

    daniel C-Busser Moderator

    Joined:
    Jul 26, 2004
    Messages:
    770
    Likes Received:
    21
    Location:
    Adelaide
    Hi sjfp,

    Out of interest, have you tried the "Document Project" button that's available when you select the project node in Toolkit? We're interested in finding out why you would rather roll your own docs, and perhaps how we could improve the built-in documentation.
     
    daniel, Sep 3, 2010
    #7
  8. sjfp

    sjfp

    Joined:
    Oct 31, 2004
    Messages:
    145
    Likes Received:
    1
    Location:
    UK
    Daniel,
    if you send me your email, i will get some examples of our paperwork to you.
     
    sjfp, Sep 3, 2010
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.