cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to capture value from inner structure

Hi guys,

Need your help here.

We are trying to capture the product Id from a adjustinventory function.

this is the function from DynaTrace:

adjustinv.png

Developer explained as that the Id of product is with in the BaseEntity

product.png

and they have show us the value from a debugger:

adjustinv-debug.png

we have tried few combination within the accessor filed (.Id, .ProductId....) with no luck...

Can any one explain please what should be the right accessor to get the Id?

thanks in advance

Yos

@gilgi@matrix.co.il

11 REPLIES 11

dave_mauney
Dynatrace Champion
Dynatrace Champion

Is there a getId() or getProductId() method in the Product class or something similar in the Entity class it inherits from? I would think you could capture arg1 (Product) from the adjustInventory method and then use an accessor such as .getProductId() to get the identifier. The list of Product methods appears to be truncated in the image attached here.

Hi Dave,

I will ask developers if there is get*() function.

Meanwhile here is the full list of the truncated product methods if it can help us:

product.txt

Yos

Hi once again Dave,

When browsing the methods I have found get_Productid() under BaseEntity

get-productid.png

So does the follow accessor should do the work?

accessor.png

Yos

The class you show in the get-productid.png doesnt seem to be BaseEntity, and it doesnt seem to be the same class as mentioned in accessor.png...so I am confused by that.

dave_mauney
Dynatrace Champion
Dynatrace Champion

The three properties I would focus on are:

public string Name { get; set; }

public string ShortDescription { get; set; }

public string FullDescription { get; set; }

I believe since these are properties, the corresponding getter would be "get_Name()" for the Name property.

You can browse the Product class to verify that.

HTH,

dave

Hi again Dave.

First of all thanks for your efforts to show us the light !

We are looking for the Id which is a number filed, so those string properties are not suite for us.

Developers explained that the product is inheriting the product Id from the BaseEntity class.

baseentity.txt

So we believe that this is the method we are looking for

method.png

The question now is what do we need to fill in the accessesor filed:

.get_Id()

.get_Id

or something else ?

Yos

dave_mauney
Dynatrace Champion
Dynatrace Champion

It should be "get_Id()". No leading period is required on the first getter. If you add more, it would look like this: "get_Foo().getBar().getBaz()"....

I would recommend browsing for the BaseEntity class so you can see the method with your own eyes, but pretty sure "get_Id()" will do it.

HTH,

dave

Hi Dave,

I have looked up for baseentity and get_id() and found it as you recommended

baseentity-get-id.png

And set the accessor to get_Id()

sensor-get-id.png

Now we are crossing our fingers here and waiting for the nightly recycle to see if we can put this issue behind and start the weekend with a smile thanks to your step by step instructions

Will update as soon as there will be results

All the best

Yos

hallelu-ya.png - Which means in Hebrew "Praise the Lord", or in this case you Dave.

Lesson learned !

Thanks a lot

Yos

Hi Yos,

I am very glad to hear you got it working!

The hard part with accessors is always finding the methods that need to be called. It is even harder with .NET properties due to the "magic" that gets done behind the scenes, making it more confusing. The key thing to remember is each property "get" is converted to "get_<PROPERY>()".

Thanks!

dave

Hi Dave,

I think I got the idea now.

Again, thanks a lot for you valuable help

Yos