cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Find material with ECTR API

0 Kudos
828

Hello everyone,
I am using the ECTR API to find documents in ECTR that are linked to a material master. To do this, I am using the following code in Visual Studio:

Dim applType As String = "SLW"

Dim config As PlmConnectorConfig = New PlmConnectorConfig(applType)

config.ApiLevel = 2

Dim connector As IPlmConnector = Nothing

connector = PlmConnectorFactory.GetPlmConnector(config)

Dim mat As PlmMaterialImpl = New PlmMaterialImpl()

mat.Number = "000000000000703904"

Dim MaterialListe As PlmMaterialList = New PlmMaterialList()

MaterialListe = connector.MaterialFind(mat)


Unfortunately, when I run the connector.MaterialFind(mat) command in ECTR, I get the following error message:


Can anyone help me to fix this error?

Thanks a lot!

Accepted Solutions (0)

Answers (3)

Answers (3)

laxnak
Member
0 Kudos

Just use the .ExtNumber instead of .Number -->

....

Dim mat As PlmMaterialImpl = New PlmMaterialImpl()

mat.ExtNumber = "000000000000703904"

...

0 Kudos

Hello,
thank you very much for your time! I will try the method materialGetData.

With kind regards

A. Huettinger

0 Kudos

Hello,

it looks like there is a bug in the ECTR coding behind the connector method MaterialFind. I was able to reproduce the error using current development version, so unfortunately the bug is still there. We have to fix it in upcoming ECTR versions.

BTW, your example code looks like you already know the full material number. If this is true (in real project and not only in this example), then you can use another connector method to get material data - materialGetData. If material with the given number exists, then you will get material details for the number, if not, you will get null as a result.

With Kind Regards,

Waldemar Tribus