Get rule set code

get/ruleSets/{ruleSetId}/code
Internal-Use Only

Returns the code for integrating within another program so that program is able to run the rule set.

Request Samples

1

Response Samples

1/* Rule Set ppn_rs1 version 1.0 generated on Mon Jul 01 06:20:20 UTC 2024 */
2
3DS2_OPTIONS LOGICALEXPR = STANDARD;
4DS2_OPTIONS SCOND = WARNING;
5DS2_OPTIONS MISSING_NOTE;
6
7/* {PACKAGE_START} */
8 package BRM_51_RuleSet_0 / inline;
9
10 dcl package logger _logger('App.demo');
11 dcl package logger logr_variableTrace('App.TableServices.DS2.Runtime.TraceVariables');
12
13 /* ---- RULE FIRED FLAG COUNT = 0 ---- */
14
15method DataGrid_addRow(package datagrid aGrid)
16returns int;
17 dcl int res rowCnt;
18 rowCnt = 0;
19 res = aGrid.rowAdd();
20 if (res = 0) then
21 rowCnt = aGrid.rowCount();
22 return rowCnt;
23end;
24
25method DataGrid_addRow(package datagrid aGrid, int numberOfRows)
26returns int;
27 dcl int res rowCnt;
28 rowCnt = 0;
29 res = aGrid.rowAdd(numberOfRows);
30 if (res = 0) then
31 rowCnt = aGrid.rowCount();
32 return rowCnt;
33end;
34
35method DataGrid_columnExists(package datagrid aGrid,
36varchar(255) col_name)
37returns int;
38 if (aGrid.columnExists(col_name)) then do;
39 return aGrid.columnIndex(col_name);
40 end;
41 return 0;
42end;
43
44method DataGrid_addCharacterColumn(package datagrid aGrid,
45varchar(255) col_name)
46returns int;
47 return aGrid.columnAddCharType(col_name);
48end;
49
50method DataGrid_Set(package datagrid aGrid,
51varchar(255) col_name,
52int row_index,
53varchar(32767) value)
54returns int;
55 return aGrid.setValue(col_name, row_index, value);
56end;
57
58 method initRdsp();
59 end;
60
61 method execute( in_out varchar "r_char",double "r_int",double "r_number",in_out package datagrid "r_dg_out");
62 dcl double "dg_index";
63
64;
65 if ("r_char" = 'Foundation') then do;
66 if (DataGrid_columnExists("r_dg_out",'r1_char_col') = 0) then do;
67 DataGrid_addCharacterColumn("r_dg_out",'r1_found_col');
68 end;
69 dg_index=DataGrid_AddRow(r_dg_out);
70 DataGrid_Set("r_dg_out",'r1_found_col', dg_index,'1 found');
71goto "end_da5a5617-ebc8-4864-a18d-fd6c29acc5be";end;
72 else do;
73 if (DataGrid_columnExists("r_dg_out",'r1_char_col') = 0) then do;
74 DataGrid_addCharacterColumn("r_dg_out",'r1_found_col');
75 end;
76 dg_index=DataGrid_AddRow(r_dg_out);
77 DataGrid_Set("r_dg_out",'r1_found_col', dg_index,'1 NOT found');
78 end;
79
80 "end_da5a5617-ebc8-4864-a18d-fd6c29acc5be":
81
82 rule_end: /* label for rule RETURN action */
83 end;
84
85/* {PACKAGE_END} */
86 endpackage;
87

Path Parameters

NameTypeRequiredDescription
ruleSetId
string
true

The rule set ID.

Query Parameters

NameTypeRequiredDescription
inlineAdvanceListValues
boolean
false

Specifies whether the currently deployed rows in an advanced list are included as inline values within the generated code. Advanced lists and rows within an advanced list can be deployed by using the SAS Intelligent Decisioning web application, the SAS Fraud Decisioning application, or the List Data API. If this parameter is 'true', the deployed rows in an advanced list are re-created as a data grid in the generated code. If this parameter is 'false', the advanced list must exist as a tabular data set on the Redis server. To get generated code for Cloud Analytic Server, Teradata, or Hadoop destinations, specify 'true' as the parameter value.

isGeneratingRuleFiredColumn
boolean
false

Determines whether the rule fired columns are included in the method signatures within the return package code. The default is 'true'.

lookupMode
string
false

Generates the code using references to the reference data domains based on the format names, the inline domain contents as conditionals, or the domain contents as DS2 packages. The default is 'format'. If the value is either format or package, the domain contents are expected to exist in that form on the Cloud Analytic Server and Micro Analytic Score server respectively. This is done the domain contents are activated using the SAS Intelligent Decisioning web application or using a Reference Data service REST API invocation. Only when executing the code would it be known that the formats or packages do not exist.

Allowed values:
formatinlinepackage
useGlobalVariableCurrentValues
boolean
false

When set to true, the current value for the global variables is used at code generation time, even if the global variable is not activated. When set to false, the value of the activated global variables is looked up and used at code execution time.

Default:
true
codeTarget
string
false

The type of platform that the generated code is run on. This affects some aspects of how the code is generated. For example, the MICROANALYTICS variables that are both input and output are listed distinctly in the execute method signature rather than as one 'in_out' parameter. The default is CAS.

Allowed values:
MICROANALYTICSERVICECAS

Responses

StatusMeaningDescription
200OKThe request succeeded.HeadersSchema
400Bad RequestThe request was invalid.Schema