Creating a Global Variable

Below is the example of using the SetRepoParams operation for creating a new global variable. The request contains repository moniker, the pattern indicating whether a global variable must be created, and metadata that contains global variable parameters. The response contains the updated list of repository global variables.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetRepoParams xmlns="http://www.fsight.ru/PP.SOM.Som">
<tMb xmlns="">
  <id>NCNODCBKFLJMFOAEBOCGFBINJBKLJKMEHIPDDDDKLEKKNJDH!M</id>
  </tMb>
<tArg xmlns="">
<pattern>
  <obInst>true</obInst>
  <sharedParams>Add</sharedParams>
  </pattern>
<meta>
<sharedParams>
<params>
<it>
  <k>-1</k>
  <id>START_PERIOD_D</id>
  <n>Calculation start date</n>
  <value>01.01.2020 00:00</value>
  <dt>4</dt>
  </it>
  </params>
  </sharedParams>
  </meta>
<metaGet>
  <obInst>true</obInst>
  <sharedParams>Get</sharedParams>
  </metaGet>
  </tArg>
  </SetRepoParams>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetRepoParamsResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>NCNODCBKFLJMFOAEBOCGFBINJBKLJKMEHIPDDDDKLEKKNJDH!M</id>
  </id>
<meta xmlns="">
<sharedParams>
  <IsShared>1</IsShared>
  <Url>http://v-shp-development.dev.fs.fsight.world</Url>
<params>
<it>
  <k>1</k>
  <id>GLOBAL_INT</id>
  <n>Constraint</n>
  <vis>1</vis>
  <value>600</value>
  <dt>2</dt>
  <binding>UI="IntegerEdit"</binding>
  </it>
<it>
  <k>2</k>
  <id>START_PERIOD_D</id>
  <n>Calculation start date</n>
  <vis>1</vis>
  <value>2020-01-01</value>
  <dt>4</dt>
  <binding />
  </it>
  </params>
  </sharedParams>
  </meta>
  </SetRepoParamsResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"SetRepoParams" :
{
"tMb" :
{
"id" : "NCNODCBKFLJMFOAEBOCGFBINJBKLJKMEHIPDDDDKLEKKNJDH!M"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"sharedParams" : "Add"
},
"meta" :
{
"sharedParams" :
{
"params" :
{
"it" :
{
"k" : "-1",
"id" : "START_PERIOD_D",
"n" : "Calculation start date",
"value" : "01.01.2020 00:00",
"dt" : "4"
}
}
}
},
"metaGet" :
{
"obInst" : "true",
"sharedParams" : "Get"
}
}
}
}

JSON response:

{
"SetRepoParamsResult" :
{
"id" :
{
"id" : "NCNODCBKFLJMFOAEBOCGFBINJBKLJKMEHIPDDDDKLEKKNJDH!M"
},
"meta" :
{
"sharedParams" :
{
"IsShared" : "1",
"Url" : "http:\/\/v-shp-development.dev.fs.fsight.world",
"params" :
{
"it" :
[
{
"k" : "1",
"id" : "GLOBAL_INT",
"n" : "Constraint",
"vis" : "1",
"value" : "600",
"dt" : "2",
"binding" : "UI="IntegerEdit""
},
{
"k" : "2",
"id" : "START_PERIOD_D",
"n" : "Calculation start date",
"vis" : "1",
"value" : "2020-01-01",
"dt" : "4",
"binding" : ""
}
]
}
}
}
}
}
public static RepoParamsResult AddSharedParam(string moniker)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetRepoParams()
{
tArg = new SetRepoParamsArg()
{
pattern = new RepoParamsMdPattern()
{
sharedParams = ListOperation.Add
},
meta = new RepoParamsMd()
{
sharedParams = new RepoSharedParams()
{
@params = new OdArg[]
{
new OdArg()
{
k = uint.MaxValue,
id = "START_PERIOD_D",
n = "Calculation start date",
value = "01.01.2020 00:00",
dt = 4 // DbDataType.DateTime
}
}
}
},
metaGet = new RepoParamsMdPattern()
{
sharedParams = ListOperation.Get
}
},
tMb = new MbId() { id = moniker }
};
//Change repository parameters
var result = somClient.SetRepoParams(tSet);
return result;
}

See also:

SetRepoParams: Operation