Clarity Service Management

Expand all | Collapse all

pdm_load modifying change category in bulk

Jump to Best Answer
  • 1.  pdm_load modifying change category in bulk

    Posted 02-15-2018 11:52 AM

    I'd like to inactivate a list of change categories in bulk. To test this, I created a text file that contains the following information:

     

       TABLE Change_Category
       sym del
       {"Active Directory.Add Business Service Portal" ,"1"}

     

    Currently, this category is active, or del = 0. Using the command above, I'm changing the del field to "1" or inactive.

    Anyway, when I ran the following command, where pdmloadtest.txt contains the command above:

     

       pdm_load -v -u -f pdmloadtest.txt

     

    I get the following error:

     

       Change_Category: Incomplete logical key.
       ERROR: Cannot create mapping for table (Change_Category)
       ERROR: Skipping table.

     

    Can someone tell me why this is failing?



  • 2.  Re: pdm_load modifying change category in bulk

    Posted 02-15-2018 12:00 PM

    Marc, Instead of referencing the sym, try using the "id" value instead. That should accept the load.



  • 3.  Re: pdm_load modifying change category in bulk

    Posted 02-15-2018 01:29 PM

    Ok. Maybe I should go one step deeper. How do I pdm_extract the id values for a list of change categories (sym)? Can I use a reference file to do pdm_extract? if so, what will the input file look like?



  • 4.  Re: pdm_load modifying change category in bulk

    Posted 02-15-2018 01:34 PM

    Marc, try this:

     

    pdm_extract -f "select sym,id,del from Change_Category"

     

    Output to a txt file and then you can edit the file and reload it.



  • 5.  Re: pdm_load modifying change category in bulk

    Posted 02-15-2018 02:01 PM

    I don't want all the list from change_category. Is there a way to extract it from a specified list? Or is the only way to do that is by exporting everything and then remove non-relevant categories?



  • 6.  Re: pdm_load modifying change category in bulk

    Posted 02-15-2018 02:48 PM

    Marc.....

     

    You can use a where clause within the PDM_EXTRACT statement.

     

    Is there some common criteria that will identify the categories that you wish to inactivate?



  • 7.  Re: pdm_load modifying change category in bulk

    Posted 02-15-2018 03:29 PM

    If I do:

       pdm_extract -f "select sym,id,del from Change_Category" > extractlist.txt

    This will load all change categories in the extractlist.txt.

     

    If I have a specific change category list ie.

    change category 1

    change category 5

    change category 6...

     

    I don't want to do extract statements for every single category:

       pdm_extract -f "select sym,id,del from Change_Category where sym='change category 1'"

       ..etc.

     

    Is there a way to do a pdm_extract from a specified list to be modified for pdm_load? Or do I have to do the full list and remove the ones that I don't want changed?



  • 8.  Re: pdm_load modifying change category in bulk

    Posted 02-15-2018 03:34 PM

    Marc,

     

    If the names were somewhat similar you could use a LIKE in your query (eg: sym LIKE 'Active Directory%').

    If the names have no shared commonality, then in reality the easiest thing, in my opinion, would be to use my query to get a full list, and then just make the edits you want to make. You can perform a full load and even overwrite the ones you want to leave as active, reloading data without altering it shouldn't cause a concern.



  • 9.  Re: pdm_load modifying change category in bulk

    Posted 02-15-2018 03:59 PM

    Thanks!



  • 10.  Re: pdm_load modifying change category in bulk

    Posted 02-15-2018 04:39 PM

    Marc, it seems you have a list of categories with sym in the list that you would like to set del=1...one way to do it is to write a script(using soap API for example) to read each sym and update the cateory accordingly(using updateObject() for example). this is more feasible if you have hundreds of categories. my 2cents. Thanks _Chi



  • 11.  Re: pdm_load modifying change category in bulk
    Best Answer

    Posted 02-15-2018 05:56 PM

    To extract the corresponding id values for a list of change category symbols, you can use pdm_deref. This tool reads a rule file and your pdm_load file, and convert your symbols into ids. 

    Regards

    ....Michael



  • 12.  Re: pdm_load modifying change category in bulk

    Posted 02-15-2018 12:53 PM

    If you are not using the id field, as advised by Alexander, to let pdm_load decide, if to update an existing record or to insert a new record, you need to specify all so called secondary key fields.

    For Table Change_Category the secondary keys are sym and code

    Hope this helps

    Regards

    .........Michael



  • 13.  Re: pdm_load modifying change category in bulk

    Posted 02-21-2018 02:18 PM

    Marc.......

     

    Do you require any additional assistance with the pdm_load process?

     

    If not please mark one of the provided responses as correct so that this thread can be closed.