Get Variant Effectivity on Mfg. Item

Introduction

This document intended to provide a detailed guide and examples on how to write EKL script to get variant effectivity on Mfg. Item.

Version – 2026xGA (For older version of 3DEXPERIENCE platform check 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)

Mfg. Item related web services

•           MFN (DELMIA Manufactured Items 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 for this export is the following: Below is the logical flow of get effectivity EKL script.

 

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.

 

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, in this case we will traverse data node to get CSRF value.

For example – Below script calls web service to get effectivity of Mfg. 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\\":[\\""+strSelctMfgItemInstPID+"\\"],"
             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)
// Checking if request return code is OK (rc = 0)
if (client.ReturnCode == 0)
{
    // success
	let jsonStr(String)
	let rootJSON(JSONNode)
	jsonStr = oDTN.ToJSON()
	set rootJSON = new("JSONNode", "Root",NULL)
	rootJSON.Parse(jsonStr)
	Let memberList(List)
	memberList = rootJSON.GetAttributeObject("effectivitiesContent")
	if (memberList <> NULL AND memberList.Size() > 0)
	{
		Let firstMember(JSONNode)
		Let variantMember(JSONNode)
		firstMember = memberList.GetItem(1)
        if(firstMember.HasAttribute("Effectivity_Variant"))
		{
			Let variantEffectivityValue(String)
			variantEffectivityValue = firstMember.GetAttributeString("Effectivity_Variant")
            oStrEffectExprsn = variantEffectivityValue
		}
	}
}
else
{
    // failure
    PopupMessage("client.ReturnCode - #, oBuffer - #", client.ReturnCode, oBuffer)
}

Here under some Use Case about possible adaptation of the script

1. Requirement 1: Get effectivity of other type of objects in structure

In above example we saw detailed explanation of how the script is written to get the effectivity of Mfg. Item, there might be requirement where we need to get effectivity of Eng. Item, System or Resource objects. In this case, user need to modify above script and reuse them.

Below are some of the changes required in the script to use it for Eng. Item, System or Resources.

  • Object selection

Based on from which type of object we want to retrieve effectivity we will set its type.

Mfg. ItemEng. ItemSystemResource
MfgProcessOccurrenceProductOccurrenceProdSystemOccurrenceResourceOccurrence

 

2. Requirement 2: 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\\":[\\""+strSelctMfgItemInstPID+"\\"],"
              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 - @RR ​​​​​​​

Person of Contact -  @KA