Get treatment definition group revision code
get/definitionGroups/{groupId}/revisions/{revisionId}/ds2Code
Returns the DS2 code for the specified treatment definition group revision.
1package dcm_treatments_79075dba_52cd_4881_8daf_86fc4c4cedc3 /inline; dcl package logger m_logger('App.SASTreatmentDefinitions'); dcl int _isDebugEnabled; dcl varchar(32767) listValues; dcl int _eligible; dcl package logger logr_variableTrace('App.TableServices.DS2.Runtime.TraceVariables'); dcl int _index;2dcl package datagrid "dgout_grid"('dgout_grid');3method DataGrid_Clear(package datagrid aGrid) returns int; aGrid.clear(); return 0; end;4method DataGrid_toString(package datagrid aGrid) returns varchar; return aGrid.serialize(); end;5method DataGrid_addRow(package datagrid aGrid) returns int; dcl int res rowCnt; rowCnt = 0; res = aGrid.rowAdd(); if (res = 0) then rowCnt = aGrid.rowCount(); return rowCnt; end;6method DataGrid_finalizeRow(package datagrid aGrid) returns int; return aGrid.rowCount(); end;7method DataGrid_columnExists(package datagrid aGrid, varchar(255) col_name) returns int; if (aGrid.columnExists(col_name)) then do; return aGrid.columnIndex(col_name); end; return 0; end;8method DataGrid_addCharacterColumn(package datagrid aGrid, varchar(255) col_name) returns int; return aGrid.columnAddCharType(col_name); end;9method DataGrid_addNumericColumn(package datagrid aGrid, varchar(255) col_name) returns int; return aGrid.columnAddNumType(col_name); end;10method DataGrid_Set(package datagrid aGrid, varchar(255) col_name, int row_index, varchar(32767) value) returns int; return aGrid.setValue(col_name, row_index, value); end;11method dcm_treatments_79075dba_52cd_4881_8daf_86fc4c4cedc3(); _isDebugEnabled = m_logger.islevelactive(3); end;12method execute( varchar(32767) "foo", in_out package datagrid "dgout" ); if (DataGrid_columnExists("dgout",'treatment_definition_group_id') = 0) then do; DataGrid_addCharacterColumn("dgout", 'treatment_definition_group_id'); /*1*/ end; if (DataGrid_columnExists("dgout",'treatment_definition_group_revision_id') = 0) then do; DataGrid_addCharacterColumn("dgout", 'treatment_definition_group_revision_id'); /*2*/ end; if (DataGrid_columnExists("dgout",'treatment_definition_id') = 0) then do; DataGrid_addCharacterColumn("dgout", 'treatment_definition_id'); /*3*/ end; if (DataGrid_columnExists("dgout",'treatment_definition_revision_id') = 0) then do; DataGrid_addCharacterColumn("dgout", 'treatment_definition_revision_id'); /*4*/ end; if (DataGrid_columnExists("dgout",'treatment_definition_name') = 0) then do; DataGrid_addCharacterColumn("dgout", 'treatment_definition_name'); /*5*/ end; if (DataGrid_columnExists("dgout",'Budget') = 0) then do; DataGrid_addNumericColumn("dgout", 'Budget'); /*6*/ end; if (DataGrid_columnExists("dgout",'Discount') = 0) then do; DataGrid_addNumericColumn("dgout", 'Discount'); /*7*/ end; if (DataGrid_columnExists("dgout",'foo') = 0) then do; DataGrid_addCharacterColumn("dgout", 'foo'); /*8*/ end; if (DataGrid_columnExists("dgout",'Goal') = 0) then do; DataGrid_addNumericColumn("dgout", 'Goal'); /*9*/ end; if (DataGrid_columnExists("dgout",'Offertext') = 0) then do; DataGrid_addCharacterColumn("dgout", 'Offertext'); /*10*/ end; if (DataGrid_columnExists("dgout",'Product') = 0) then do; DataGrid_addCharacterColumn("dgout", 'Product'); /*11*/ end; if (DataGrid_columnExists("dgout",'TimesClicked') = 0) then do; DataGrid_addNumericColumn("dgout", 'TimesClicked'); /*12*/ end;13"_eligible" = 1; if(_isDebugEnabled = 1) then do; if("_eligible" = 1) then do; m_logger.log(3, 'Treatment Definition with id 81b5f14a-f131-4a2c-a84f-62175b27a9a1 and revisionId ac372328-9220-44c1-8ee5-d2d75607bc87 is eligible.'); end; else do; m_logger.log(3, 'Treatment Definition with id 81b5f14a-f131-4a2c-a84f-62175b27a9a1 and revisionId ac372328-9220-44c1-8ee5-d2d75607bc87 is not eligible.'); end; end;14if("_eligible" = 1) then do; _index=DataGrid_AddRow("dgout"); DataGrid_Set("dgout",'treatment_definition_group_id', _index,'625e99fd-4d8a-4ee2-b201-4fd3c062169f'); /*treatment_definition_group_id*/ DataGrid_Set("dgout",'treatment_definition_group_revision_id',_index,'79075dba-52cd-4881-8daf-86fc4c4cedc3'); /*treatment_definition_group_revision_id*/ DataGrid_Set("dgout",'treatment_definition_id', _index,'81b5f14a-f131-4a2c-a84f-62175b27a9a1'); /*treatment_definition_id*/ DataGrid_Set("dgout",'treatment_definition_revision_id', _index, 'ac372328-9220-44c1-8ee5-d2d75607bc87'); /*treatment_definition_revision_id*/ DataGrid_Set("dgout",'treatment_definition_name', _index,'Treatment_2'); /*treatment_definition_name*/ DataGrid_Set("dgout", 'foo',_index, "foo"); /*foo*/ DataGrid_FinalizeRow("dgout"); end;15"_eligible" = 1; if(_isDebugEnabled = 1) then do; if("_eligible" = 1) then do; m_logger.log(3, 'Treatment Definition with id da85cd3c-7c7a-437c-acac-eca2819c9a6d and revisionId 9ce585d7-898d-47d9-9441-00e2628e204f is eligible.'); end; else do; m_logger.log(3, 'Treatment Definition with id da85cd3c-7c7a-437c-acac-eca2819c9a6d and revisionId 9ce585d7-898d-47d9-9441-00e2628e204f is not eligible.'); end; end;16if("_eligible" = 1) then do; _index=DataGrid_AddRow("dgout"); DataGrid_Set("dgout",'treatment_definition_group_id', _index,'625e99fd-4d8a-4ee2-b201-4fd3c062169f'); /*treatment_definition_group_id*/ DataGrid_Set("dgout",'treatment_definition_group_revision_id',_index,'79075dba-52cd-4881-8daf-86fc4c4cedc3'); /*treatment_definition_group_revision_id*/ DataGrid_Set("dgout",'treatment_definition_id', _index,'da85cd3c-7c7a-437c-acac-eca2819c9a6d'); /*treatment_definition_id*/ DataGrid_Set("dgout",'treatment_definition_revision_id', _index, '9ce585d7-898d-47d9-9441-00e2628e204f'); /*treatment_definition_revision_id*/ DataGrid_Set("dgout",'treatment_definition_name', _index,'My Treatment Definition'); /*treatment_definition_name*/ DataGrid_Set("dgout", 'TimesClicked',_index, .); /*TimesClicked*/ DataGrid_Set("dgout", 'Goal',_index, to_double(date '2018-07-13')); /*Goal*/ DataGrid_Set("dgout", 'Budget',_index, 500); /*Budget*/ DataGrid_Set("dgout", 'Offertext',_index, 'Get a new IPhone now and get 30% off iPad'); /*Offertext*/ DataGrid_Set("dgout", 'Product',_index, 'iPhone'); /*Product*/ DataGrid_Set("dgout", 'Discount',_index, 30); /*Discount*/ DataGrid_FinalizeRow("dgout"); end; end;17method execute_skel( varchar(32767) "foo", in_out varchar "dgout" ); dcl integer localRC; localRC = DataGrid_clear("dgout_grid");18execute( "foo", "dgout_grid" );19"dgout" = DataGrid_toString("dgout_grid"); end;20endpackage;
Name | Type | Required | Description |
---|---|---|---|
groupId | string | true | The unique identifier for the treatment definition group. Examples: "625e99fd-4d8a-4ee2-b201-4fd3c062169f" |
revisionId | string | true | The unique identifier for the revision of the specified treatment definition group. Delegate @current can be used to get the current revision. Delegate @active can be used to get the active revision. Examples: "178c8c19-8493-46b4-8004-94cf73ba5b9e" |