Get Variant Effectivity on Eng. Item or Resource

Introduction

This document intended to provide a detailed guide and examples on how to write EKL script to get variant effectivity on Engineering Item or Product. The same script can be used for getting effectivity on Resource.

 

Version – 2026x GA (For older releases of 3DEXPERIENCE Platform check out the older version of this article).

Pre-requisites

Licenses – These EKL scripts call 3DSpace web services, which require specific licenses to execute as mentioned in below table. (These are referred from developer documentation of web services)

Engineering Item related web services

•           XEN (Product Release Engineer) For dseng:EnterpriseReference(Authoring) Web Services

•           XEN (Product Release Engineer) or PAU (3D Product Architect), For dseng:EngItem (Authoring) and dseng:EngInstance (Authoring) Web Services

•           CSV (Industry Innovation), For Reading Web Services

Resource related web services

•           MGA (DELMIA Process Management)

•           FAM (DELMIA Factory Asset Management)

•           CSV (Industry Innovation) For Reading Web Services

Model configuration, effectivity or IP Configuration related web services

•           CFG (Configuration Management), for all dscfg web services

•           CSV (Industry Innovation), For Reading Web Services

 

Disclaimer: Licenses mentioned above are as per 2026x documentation.

Logical Flow

The sequence of the scripts/ steps for this get effectivity EKL script is the following.

 

Example

Disclaimer: This code is just an example and should only be used by people who know the Enterprise Knowledge Language (EKL) and the DELMIA data model very well. The intent is not to provide a ready to deploy product code. So we are not responsible for any issues you may face with this code.

 

Get_Variant_Effectivity_Eng_Item

Detail Explanation

How to call web services

Steps followed for calling all web services.

  1. Create HTTP client.
  2. Define header for the HTTP client.
  3. Build web service URI.
  4. Perform GET/POST request.
  5. Retrieve the returned response code if it is zero / as per documentation then ok else error case.
  6. To retrieve the required content from the response traverse through returned data node or buffer.

For example – Below script calls web service to get effectivity of Eng. Item instance.

// Get Effectivity on Instance found in above step	
// Creates an HTTP client
client = CreateHTTPClient()	
// Defines Headers
client.AddRequestHeaders("Content-Type: application/json")
client.AddRequestHeaders("Accept: application/json")
client.AddRequestHeaders("SecurityContext: "+securityCtx)
client.AddRequestHeaders("ENO_CSRF_TOKEN: "+csrfToken)	

Let jsonBody(String)
// Defines URI and Body
iURI = serverURL +"/resources/v1/modeler/dscfg/invoke/dscfg:getEffectivityContent"
jsonBody = "{"
jsonBody = jsonBody + "\\"ids\\":[\\""+strSelctEngItemInstPID+"\\"],"
jsonBody = jsonBody + "\\"domain\\":\\"ALL\\","
jsonBody = jsonBody + "\\"view\\":\\"ALL\\","
jsonBody = jsonBody + "\\"format\\":\\"TXT\\""
jsonBody = jsonBody + "}"

//Performs a POST request
oBuffer = client.Post(iURI, "HTTPDEFINED", jsonBody, oDTN)
//PopupMessage("",oBuffer)
// Checking if request return code is OK (rc = 0)
if (client.ReturnCode == 0)
{
	// success
	//PopupMessage("client.ReturnCode - #, oBuffer - #", client.ReturnCode, oBuffer)
	let jsonStr(String)
	let rootJSON(JSONNode)
	jsonStr = oDTN.ToJSON()
	set rootJSON = new("JSONNode", "Root",NULL)
	rootJSON.Parse(jsonStr)
	/* Root.member */
		Let memberList(List)
		memberList = rootJSON.GetAttributeObject("effectivitiesContent")
		
		if (memberList <> NULL AND memberList.Size() > 0)
		{
			Let firstMember(JSONNode)
			Let variantMember(JSONNode)
			firstMember = memberList.GetItem(1)
			//PopupMessage("",firstMember.Stringify())
			if(firstMember.HasAttribute("Effectivity_Variant"))
			{
				//PopupMessage("has attr")
				Let variantEffectivityValue(String)
				//attrType =firstMember.GetAttributeType("Effectivity_Variant")
				//PopupMessage("attrType...",attrType)
				variantEffectivityValue = firstMember.GetAttributeString("Effectivity_Variant")
				PopupMessage("Effectivity Expression - ||", variantEffectivityValue)
				oStrEffectExprsn = variantEffectivityValue
		}
			//variantMember = memberList.GetItem(1)
			//PopupMessage("",variantMember.Stringify())
			
		}
	}
else
{
	// failure
	PopupMessage("client.ReturnCode - #, oBuffer - #", client.ReturnCode, oBuffer)
}

 

Here is one Use Case about possible adaptation of the script

Requirement : Get effectivity expression in different format

Based on the values we pass as JSON load to web service the response we get will change and then we can utilize as per our need.

In our example, we used below values:

 jsonBody = "{"
              jsonBody = jsonBody + "\\"ids\\":[\\""+strSelctEngItemInstPID+"\\"],"
              jsonBody = jsonBody + "\\"domain\\":\\"ALL\\","
              jsonBody = jsonBody + "\\"view\\":\\"ALL\\","
              jsonBody = jsonBody + "\\"format\\":\\"XML\\""
             jsonBody = jsonBody + "}"

We have different values available for different inputs for the JSON body. If we follow below table then we can have effectivity in different format or different view etc… (Below table is available in developer’s assistance documentation)

Domain

string
example: ALL

Domain is used to filter the effectivity information. Valid values for domain are EVOLUTION, VARIANT, ALL, Default.

view

string
example: ALL

View is used to filter the effectivity information. Valid values for view are CURRENT, PROJECTED, ALL, Default.

format

string
example: TXT

Format is used to define how effectivity expressions are returned in response. Valid values for format are TXT, XML.

If we need to get effectivity expression in TEXT format and we want EVOLUTION effectivity with PROJECTED view then above JSON must be changed as below,

jsonBody = "{"               
             jsonBody = jsonBody + "\\"ids\\":[\\""+ strSelctSystemInstPID+"\\"],"                         
             jsonBody = jsonBody + "\\"domain\\":\\"EVOLUTION\\","               
             jsonBody = jsonBody + "\\"view\\":\\"PROJECTED\\","               
             jsonBody = jsonBody + "\\"format\\":\\"TXT\\""               
            jsonBody = jsonBody + "}"

How to Deploy

Follow below steps to deploy the above EKL script

  1. Download the Provided EKL Script
  2. Create one new "Physical Product" to act as a container for the EKL action and give it some suitable name. For ex. "Get_Variant_Effectivity_EKL_scripts"
  3. Create a new "Knowledge Action" in the newly created Physicals Product and give it a suitable name. Follow the sample video available on this page to know "How to create Knowledge Action".
  4. Set the input arguments as explained at the top of the script in the "Input output argument" comment.
  5. Save the script
  6. Execute the script

Author

Author - @& ​​​​​​​

Person of Contact -  @@KA