Hi,
I have this script where I tried to modify an association and an attribute value. The modification of the association works, but I can not change the attribute value of the created feature. (See first script)
If I trie to modify an attribute value of another feature (not the creaded on) it works. (See second script)
I tried also to change only to attribute value, without modifying the association. It did also not work out. (See third script)
Changes in the script are only made within the return statement.
First script:
// MV Connector Line (Verbindingskabel) whithout Containment -> MV Substation
if (($feature.assetgroup == 929 && $feature.ASSET_NUMBER == "associate")) {
var update_class = 'ElectricLine'
var update_class_asso = 'ElectricAssembly'
var filterAssembly = "ASSETGROUP = 904"
var boundaries = FeatureSetByName($datastore, "FLUVIUS_1091_DESIGN.UTROOT.StructureBoundary", ["globalid"], true);
if(isempty(boundaries)){
return;
//{"errorMessage": "Error 1"};
};
var intersectBoundaries = Intersects(boundaries, $feature);
if(isempty(intersectBoundaries)){
return;
//{"errorMessage": "Error 2"};
};
var structureBoundary = First(intersectBoundaries);
if(isempty(structureBoundary)){
return;
//{"errorMessage": "Error 3"};
}
var AllAssemblys = FeatureSetByName($datastore, "FLUVIUS_1091_DESIGN.UTROOT.ElectricAssembly", ["assetgroup", "globalid"], true);
if(isempty(AllAssemblys)){
return;
//{"errorMessage": "Error 4"};
}
var XYassembly = Filter(AllAssemblys, filterAssembly)
if(isempty(XYassembly)){
return;
//{"errorMessage": "Error 5"};
};
var intersectAssembly = Intersects(XYassembly, structureBoundary);
if(isempty(intersectBoundaries)){
return;
//{"errorMessage": "Error 6"};
};
var assemblyGeo = First(intersectAssembly)
if(isempty(assemblyGeo)){
return;
//{"errorMessage": "Error 7"};
}
return {
"edit":[{
"className": update_class_asso,
"updates":[{
"globalid": assemblyGeo.globalid,
"associationType":"container"
}]
}, {
"className": update_class,
'updates': [{
'globalID': $feature.globalid,
'attributes': {
'ASSET_NUMBER': "Test"
}
}]
}]
}
}
Second Script:
// MV Connector Line (Verbindingskabel) whithout Containment -> MV Substation
if (($feature.assetgroup == 929 && $feature.ASSET_NUMBER == "associate")) {
var update_class = 'ElectricLine'
var update_class_asso = 'ElectricAssembly'
var filterAssembly = "ASSETGROUP = 904"
var boundaries = FeatureSetByName($datastore, "FLUVIUS_1091_DESIGN.UTROOT.StructureBoundary", ["globalid"], true);
if(isempty(boundaries)){
return;
//{"errorMessage": "Error 1"};
};
var intersectBoundaries = Intersects(boundaries, $feature);
if(isempty(intersectBoundaries)){
return;
//{"errorMessage": "Error 2"};
};
var structureBoundary = First(intersectBoundaries);
if(isempty(structureBoundary)){
return;
//{"errorMessage": "Error 3"};
}
var AllAssemblys = FeatureSetByName($datastore, "FLUVIUS_1091_DESIGN.UTROOT.ElectricAssembly", ["assetgroup", "globalid"], true);
if(isempty(AllAssemblys)){
return;
//{"errorMessage": "Error 4"};
}
var XYassembly = Filter(AllAssemblys, filterAssembly)
if(isempty(XYassembly)){
return;
//{"errorMessage": "Error 5"};
};
var intersectAssembly = Intersects(XYassembly, structureBoundary);
if(isempty(intersectBoundaries)){
return;
//{"errorMessage": "Error 6"};
};
var assemblyGeo = First(intersectAssembly)
if(isempty(assemblyGeo)){
return;
//{"errorMessage": "Error 7"};
}
return {
"edit":
[
{"className": update_class_asso,
"updates":[{
"globalid": assemblyGeo.globalid,
"associationType":"container"
}],
'updates': [{
'globalID': assemblyGeo.globalid,
'attributes': {
'ASSET_NUMBER': "Test"
}
}]
}]
}
}
Third script:
// MV Connector Line (Verbindingskabel) whithout Containment -> MV Substation
if (($feature.assetgroup == 929 && $feature.ASSET_NUMBER == "associate")) {
var update_class = 'ElectricLine'
var update_class_asso = 'ElectricAssembly'
var filterAssembly = "ASSETGROUP = 904"
var boundaries = FeatureSetByName($datastore, "FLUVIUS_1091_DESIGN.UTROOT.StructureBoundary", ["globalid"], true);
if(isempty(boundaries)){
return;
//{"errorMessage": "Error 1"};
};
var intersectBoundaries = Intersects(boundaries, $feature);
if(isempty(intersectBoundaries)){
return;
//{"errorMessage": "Error 2"};
};
var structureBoundary = First(intersectBoundaries);
if(isempty(structureBoundary)){
return;
//{"errorMessage": "Error 3"};
}
var AllAssemblys = FeatureSetByName($datastore, "FLUVIUS_1091_DESIGN.UTROOT.ElectricAssembly", ["assetgroup", "globalid"], true);
if(isempty(AllAssemblys)){
return;
//{"errorMessage": "Error 4"};
}
var XYassembly = Filter(AllAssemblys, filterAssembly)
if(isempty(XYassembly)){
return;
//{"errorMessage": "Error 5"};
};
var intersectAssembly = Intersects(XYassembly, structureBoundary);
if(isempty(intersectBoundaries)){
return;
//{"errorMessage": "Error 6"};
};
var assemblyGeo = First(intersectAssembly)
if(isempty(assemblyGeo)){
return;
//{"errorMessage": "Error 7"};
}
return {
"edit":[{
"className": update_class,
'updates': [{
'globalID': $feature.globalid,
'attributes': {
'ASSET_NUMBER': "Test"
}
}]
}]
}
}