{
  "Name": "ReportWORQ - Pause Response Reader 1.0 (PA v11)",
  "HasSecurityAccess": false,
  "PrologProcedure": "#****Begin: Generated Statements***\r\n#****End: Generated Statements****\r\n\r\n\r\n# PROCESS Overview and Key Information:\r\n\r\n# ReportWORQ - Pause Response Reader 1.0 (PA v11)\r\n#A helper for the two Planning Analytics v11 pause samples, ReportWORQ - Global Pause Control Sample 1.0 (PA v11) and ReportWORQ - Pause Run Resume Sample 1.0 (PA v11). Import it together with them, under this exact name. You do not run it yourself.\r\n#Planning Analytics v11 has no TI function that sends an HTTP request (ExecuteHttpRequest exists only on Planning Analytics Engine, v12), so those samples run curl with ExecuteCommand and curl writes the Reportworq answer to a text file. A TI prolog cannot read a file, so they call this process to read it: its data source is that file.\r\n#It hands the answer back in two global variables: gReportworqHttpStatus (the HTTP status code curl wrote on the last line, 0 when there was no answer) and gReportworqHttpBody (everything before that line).\r\n#It writes nothing to the TM1 message log, and the file it reads never holds the access token.\r\n#Please note that you do not need to edit anything on any tab of this TI Process.\r\n#----------------------------------------------------------------------------\r\n\r\n\r\n# TI PARAMETERS Included definitions:\r\n\r\n# pFile (String): Full path of the answer file to read. Blank reads nothing (the samples call it that way once, to check that it is installed).\r\n#----------------------------------------------------------------------------\r\n\r\n\r\n#No edit to below statements needed#\r\n\r\nStringGlobalVariable( 'gReportworqHttpStatus' );\r\nStringGlobalVariable( 'gReportworqHttpBody' );\r\ngReportworqHttpStatus = '0';\r\ngReportworqHttpBody = '';\r\n\r\n#The data tab keeps the previous line, because the last line of the file is the status code and not part of the answer.\r\nvPreviousLine = '';\r\nnLines = 0;\r\n\r\nvFile = TRIM( pFile );\r\nIF( vFile @= '' );\r\n  DataSourceType = 'NULL';\r\nELSEIF( FileExists( vFile ) = 0 );\r\n  DataSourceType = 'NULL';\r\nELSE;\r\n  DataSourceType = 'CHARACTERDELIMITED';\r\n  DatasourceNameForServer = vFile;\r\n  DatasourceNameForClient = vFile;\r\n  #One variable per line: a delimiter and a quote character that never occur in the answer.\r\n  DatasourceASCIIDelimiter = CHAR(1);\r\n  DatasourceASCIIQuoteCharacter = '';\r\n  DatasourceASCIIHeaderRecords = 0;\r\nENDIF;\r\n",
  "MetadataProcedure": "\r\n#****Begin: Generated Statements***\r\n#****End: Generated Statements****",
  "DataProcedure": "#****Begin: Generated Statements***\r\n#****End: Generated Statements****\r\n\r\n#Every line but the last is the answer; the last one is the status code. Please do not edit this tab.\r\nStringGlobalVariable( 'gReportworqHttpStatus' );\r\nStringGlobalVariable( 'gReportworqHttpBody' );\r\n\r\nvText = vLine;\r\nIF( LONG( vText ) > 0 );\r\n  IF( SUBST( vText, LONG( vText ), 1 ) @= CHAR(13) );\r\n    vText = SUBST( vText, 1, LONG( vText ) - 1 );\r\n  ENDIF;\r\nENDIF;\r\n\r\nIF( nLines > 0 );\r\n  gReportworqHttpBody = gReportworqHttpBody | vPreviousLine;\r\nENDIF;\r\nvPreviousLine = vText;\r\nnLines = nLines + 1;\r\n",
  "EpilogProcedure": "#****Begin: Generated Statements***\r\n#****End: Generated Statements****\r\n\r\n#The last line is the status code curl wrote (000 when there was no answer). Anything else is part of the answer. Please do not edit this tab.\r\nStringGlobalVariable( 'gReportworqHttpStatus' );\r\nStringGlobalVariable( 'gReportworqHttpBody' );\r\n\r\nvCode = TRIM( vPreviousLine );\r\nnDigits = 0;\r\nIF( LONG( vCode ) = 3 );\r\n  nDigits = 1;\r\n  nChar = 1;\r\n  WHILE( nChar <= 3 );\r\n    IF( SCAN( SUBST( vCode, nChar, 1 ), '0123456789' ) = 0 );\r\n      nDigits = 0;\r\n    ENDIF;\r\n    nChar = nChar + 1;\r\n  END;\r\nENDIF;\r\n\r\nIF( nDigits = 1 );\r\n  gReportworqHttpStatus = vCode;\r\nELSE;\r\n  gReportworqHttpStatus = '0';\r\n  gReportworqHttpBody = gReportworqHttpBody | vPreviousLine;\r\nENDIF;\r\n",
  "Parameters": [
    {
      "Name": "pFile",
      "Prompt": "Full path of the answer file to read (set by the PA v11 pause samples; blank reads nothing)",
      "Value": "",
      "Type": "String"
    }
  ],
  "Variables": [
    {
      "Name": "vLine",
      "Type": "String",
      "Position": 1,
      "StartByte": 0,
      "EndByte": 0
    }
  ],
  "DataSource": {
    "Type": "ASCII",
    "asciiDecimalSeparator": ".",
    "asciiDelimiterChar": ",",
    "asciiDelimiterType": "Character",
    "asciiHeaderRecords": 0,
    "asciiQuoteCharacter": "",
    "asciiThousandSeparator": ",",
    "dataSourceNameForClient": "ReportworqPauseResponse.txt",
    "dataSourceNameForServer": "ReportworqPauseResponse.txt"
  }
}