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.
{
"SetRepoParams" :
{
"tMb" :
{
"id" : "S1!M"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"sharedParams" : "Add"
},
"meta" :
{
"sharedParams" :
{
"params" :
{
"it" :
{
"k" : "18446744073709551615",
"id" : "START_PERIOD_D",
"n" : "Calculation start date",
"value" : "01.01.2020 00:00",
"dt" : "4"
}
}
}
},
"metaGet" :
{
"obInst" : "true",
"sharedParams" : "Get"
}
}
}
}
{
"SetRepoParamsResult" :
{
"id" :
{
"id" : "S1!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 = ulong.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: