Blade ZipKit – Custom CSV and TAB delimited grammar files

Version 3
    Share:|

    Blade ZipKit Package Info

    Name: Custom CSV and TAB delimited grammar files

    Type: NSH Script, Grammar Files

    BSA Compatible Version: 8.3.x +

    Version: 1.0

    More Info: N/A

    Created by: Yanick Girouard

    Tested version on: AppServer version 8.5.01.304

    Tested against host running: N/A


    Brief Description:

     

    This package imports 4 different custom grammar files using csv and tab as delimiter. Their purpose is to change the way the key of each record is generated to allow for better reporting of snapshot data. The out of the box csv grammar uses a concatenation of all fields, making it difficult to filter on the record names, or use this data for change tracking because the key (name column)  are always different.


    Included in the zip:

     

    custom_csv.gm: grammar for comma delimited output using first field as the record’s primary key

    custom_csv_dual.gm: grammar for comma delimited output using first two fields as the record’s primary key (i.e. field1-field2)

    custom_tab.gm: grammar for tab delimited output using first field as the record’s primary key

    custom_tab_dual.gm: grammar for tab delimited output using first two fields as the record’s primary key (i.e. field1-field2)

    import_grammar.nsh: simple script to load the grammar files into the database and file server


    Examples of transformations:


    Use case examples for first field as key (same for both csv and tab, just change the delimiter accordingly):


    # csv output

    unique1,field1,field2,field3

    unique2,field1,field2,field3


    # Becomes this :


    NameValue1Value2Value3
    unique1field1field2field3
    unique2field1field2field3


    Use case examples for first two fields as key (same for both csv and tab, just change the delimiter accordingly):

     

    # csv output

    unique1,sub1,field1,field2,field3

    unique1,sub2,field1,field2,field3

    unique2,sub1,field1,field2,field3

    unique2,sub2,field1,field2,field3


    # Becomes this:


    NameValue1Value2Value3
    unique1-sub1field1field2field3
    unique1-sub2field1field2field3
    unique2-sub1field1field2field3
    unique2-sub2field1field2field3



    Instructions:


    1. Download the attached zip file to any computer with NSH shell access.
    2. Extract the zip file to a directory of your choice (i.e. C:\temp)
    3. From a local NSH shell prompt, call the import_grammar.nsh script and specify the local directory where you extracted the zip as the only argument. Example:

      ./import_grammar.nsh /c/temp
    4. Create a new extended object in the BSA console and confirm that you see the new grammar files.


    *Note: This is a community-supported package.