Topic
4 replies Latest Post - ‏2013-05-06T14:16:18Z by MolumaTresa
MolumaTresa
MolumaTresa
23 Posts
ACCEPTED ANSWER

Pinned topic Command to run ruleset using commman line and to obtain the output in csv format

‏2013-05-03T11:06:28Z |

CAn anyone tell me the command to run a rule set using the command line such that I must get the output of it in CSV format .Is this possible.

 

Or atleast the command to run the ruleset using the command lline and to get the output of it in xml format

  • smithha
    smithha
    144 Posts
    ACCEPTED ANSWER

    Re: Command to run ruleset using commman line and to obtain the output in csv format

    ‏2013-05-03T16:17:43Z  in response to MolumaTresa

    You can find the list of available command line options here:  http://pic.dhe.ibm.com/infocenter/iisinfsv/v9r1/topic/com.ibm.swg.im.iis.ia.restapi.doc/topics/r_cli_api_syntax.html

    To run a rule set you need to use the Execute Task command.

    
    IAAdmin -user <your-id> -password 
    <your-pwd> 
    -host <servername> -port 9080 
    -runTasks -content <
    XML file name>
    

    The items that you want to execute are put into an XML file in a given directory path.  You need to include the path and file name.  The path/file combination will need to vary depending on whether you are running the command from your client or from the server.

    The XML format needs to follow the schema for task execution.  The specific reference to the schema structure is here:  http://pic.dhe.ibm.com/infocenter/iisinfsv/v9r1/topic/com.ibm.swg.im.iis.ia.restapi.doc/topics/r_xsd_tasks.html

    The relevant schema section looks like this:

    
      <Tasks>
         <RunRules>
            <SampleOptions type="every_nth" size="1000" nthvalue="10"/>
            <Schedule startDate="2010-02-09T18:56:31+01:00" runUntil=
              "2010-02-15T10:00:00+01:00" nbOfInstances="10">
                <ScheduleRepeat second="0" minute="0" hour="12" 
                  dayOfMonth="*" month="*" dayOfWeek="?" year="*"/>
            </Schedule>
           
    <ExecutableRule name="rule1"/>
           <ExecutableRule name="rule2"/>
           <ExecutableRule name="rule3"/>
         </RunRules>
     
      </Tasks>
    
    

    Where you see <ExecutableRule name="rule1"/>  you can include the name of your rule or rule set.

    The execution will run your rule and produce the output in the IA tables. 

    You will need a subsequent, separate command to retrieve the output (the execute task does not return execution output to you).  The command to execute depends on whether you want the execution history (summary) or the detail output table.

    If you want execution history use:

    
    IAAdmin -user <your-id> -password 
    <your-pwd> 
    -host <servername> -port 9080 
    -getExecutionHistory -projectName 
    <
    project name> -ruleName <
    rule name> 
    [-xml | -csv | -xsl <
    XSL file name>] [-output <
    output file name>]
    

    If you want detail information use:

    
    IAAdmin -user <your-id> -password 
    <your-pwd> 
    -host <servername> -port 9080 
    -getOutputTable -projectName 
    <
    project name>  -ruleName <
    rule name> -executionID <
    execution ID> 
    [-xml | -csv | -xsl <
    XSL file name>] 
    [-output <
    output file name>]
    

    The default format for the results is XML.  It will return results in the format listed in the schema definitions as described in the documentation.

    There are options to return results as -csv or -xsl.  The csv format option includes header/footer information that I often find extraneous.  I find you get more control over your output by defining an xsl stylesheet for the xml.  If you include the -xsl option, you will also need to include the path and filename for the stylesheet.

    For reference the following is an example of a stylesheet that will format rule output into a csv format:

      <?xml version="1.0" encoding="ISO-8859-1" ?>
    - <xsl:stylesheet version="1.0" xmlns:iaapi="http://www.ibm.com/investigate/api/iaapi" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:strip-space elements="*" />
      <xsl:output method="text" />
    - <xsl:template match="iaapi:OutputTable/OutputDefinition">
    - <xsl:for-each select="OutputColumn">
      <xsl:value-of select="@name" />
    - <xsl:if test="position() != last()">
      <xsl:value-of select="','" />
      </xsl:if>
      </xsl:for-each>
      <xsl:text disable-output-escaping="yes"></xsl:text>
      </xsl:template>
    - <xsl:template match="iaapi:OutputTable/Rows">
    - <xsl:for-each select="Row">
    - <xsl:for-each select="*">
      <xsl:variable name="value" select="." />
      <xsl:if test="contains($value, ',')">"</xsl:if>
      <xsl:value-of select="." />
      <xsl:if test="contains($value, ',')">"</xsl:if>
    - <xsl:if test="position() != last()">
      <xsl:value-of select="','" />
      </xsl:if>
      </xsl:for-each>
      <xsl:text></xsl:text>
      </xsl:for-each>
      </xsl:template>
      </xsl:stylesheet>

    Hope that helps.

    Harald

     

    • MolumaTresa
      MolumaTresa
      23 Posts
      ACCEPTED ANSWER

      Re: Command to run ruleset using commman line and to obtain the output in csv format

      ‏2013-05-06T05:38:04Z  in response to smithha

      Actually I want to get the ouput  of   it in csv format while the rule set has finished running using "iaJob"

       


      C:\IBM\InformationServer\ASBNode\bin>iaJob -user isadmin -password Lucid2012 -is
      Host 192.168.168.128 -port 9080 -csv -output C:/tr.csv  -run  AMC_Prod_Lit  RS_A
      MCStubsAccount_PreferredThetreNumber_Non_Null_Empty

      But this doen't give correct output . What should I Do

       

       

       

      • smithha
        smithha
        144 Posts
        ACCEPTED ANSWER

        Re: Command to run ruleset using commman line and to obtain the output in csv format

        ‏2013-05-06T12:29:44Z  in response to MolumaTresa

        The iaJob command is primarily a function to execute or run jobs, not to generate or format output. 

        It does the same thing that a submit function does within the UI. The jobs produce output in the database but do not direct output further.

        While you can run a report from iaJob to produce output, I recommend using the iaAdmin CLI as noted above to retrieve and format output once the job has run.

         

        Harald

        • MolumaTresa
          MolumaTresa
          23 Posts
          ACCEPTED ANSWER

          Re: Command to run ruleset using commman line and to obtain the output in csv format

          ‏2013-05-06T14:16:18Z  in response to smithha

          hi Harald,

           

          Thank you so much for your prompt reply