SysDictClass dictClass = SysDictClass::newName(classStr(LeaveRequestContract)); DataMemberAttribute attribute = dictClass.getAttribute(classStr(DataMemberAttribute)) ; Info(strFmt("%1", attribute.Name()));
how to get the label name using datamemberattribute in contact class in x .I have tried the code above mentioned but I am getting the error "Object not set an instance of object".
Any other way or code to achieve this.
Thanks in advance,
Lakshmi.
Hi sir, sorry for the late response,
SysDictMethod dictMethod = new SysDictMethod(UtilElementType::ClassInstanceMethod, classNum(RequestContract), methodStr(RequestContract,parmRequestDate )); DataMemberAttribute attribute = dictMethod.getAttribute(classStr(DataMemberAttribute)); Info(strFmt("%1", attribute.Name())); // works fine return name :- Request date Now, i need it dynamically 'class name' and 'Method name' Tmp listOfAttributeName(ClassId _classId, SysMethodName _name) { // here i want loop all attribute return tmp; }I want to loop attribute name so that how to do ?
Thanks
Okay sir, i will bring back parmTransDate lookup and i will go to add another field like.
Name :-
ListOfParmsFields
Description.
I.e :- if i select to parmTransDate then description will be 'RequestDate' so that we can achieve modified this thing? Or any other alternative way you have please give me.
That the value is null means that the variable is empty; it doesn't contain any object. And trying to access properties of nothing (null) is impossible, therefore you get an error. A solution is putting an object to the variable.
Sir, i have debugged the same line getting error 'object reference' was it null what does mean already available in the contract class dataMemberAttribute name i didn't get why that error says like. I'm populate that method in lookup.
And it's in-memory table.
Now, how to overcome object reference error sir.?
Thanks
It seems that attributes is null (you can verify it in debugger), therefore your problem is elsewhere. You need to look at how you populate the value of attributes variable.
Thanks sir, i got it.
I did as you said with AxAttributes
Now, getting object reference error. (MethodNameTmp.name = attributes.Name getting sir.
If you already forgot how to use the enumerator, simply look at your code again and see how the collection of methods is iterated.
You'll likely get more details in IntelliSense if you declare the variable with a specific type (AxAttribute) instead of var. By the way, it sounds like that you forgot that you can see properties in the debugger.
Thanks for your valuable suggestions sir,
In my contract class i defined dataMemberAttribute for each parm fields and i feel hard only metadata API to be honest I don't know how to iterate the attributes and collection object attributes how to to assign string field? Intellisence if i type some method not come in metadata API that is why i asked give example next time I will keep in mind and will think what I need. Would be great if you provide attributes.
Thanks
Trying to assign a collection of attributes objects to a string field indeed makes no sense at all and it must fail.
Please stop writing code for a moment and think about what you want.
Let me help you... A method can be decorated with zero to many attributes. Attributes property contains them, therefore there you can find nothing, a single attribute or multiple attributes there. Before you can get the name, you must find the right attribute: DataMemberAttribute. Therefore you need to iterate the attributes (you should already know how to use an enumerator) and check out their properties to find the right one.
Thanks sir, as you said how can I get attribute with axMethod?
TMP.Name = method.Attributes; getting error sir. If i get attributes then it would be nice and i will get it. That point only I'm stuck.
André Arnaud de Cal...
292,162
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156