cancel
Showing results for 
Search instead for 
Did you mean: 

Get Attribute from a view on action button click

Justin_Baur
Star Contributor
Star Contributor

I would like to get the Job Number from a WorkView view.  Then using that value I would run a filter query to get all "Drawings" related to that Job Number.  I have gotten my Unity Script to run a filter query and get a list of WorkView class objects related to a job number but I have to hardcode in that Job Number.  I would like the the Action button to take the Job Number from the view that is opened by the user and filter automatically by that job number to find all of the drawings related to it and then run the rest of my script with that list.  The job number is an Integer data type. I am able to find information about the attribute (Name, ID, Class, Attribute Type) I want but not the value itself. Is there a way to do that from the View?  Is there a way to store it as a property and then retrieve it from  the 'args'?

1 ACCEPTED ANSWER

Justin_Baur
Star Contributor
Star Contributor

Since I was able to find this out on my own with a lot of trial and error I thought I would share the answer. 

Just declare a blank string that you would like to store your attribute value that you will get.

string jobNum = "";

Then

jobNum = args.Object.AttributeValues.Find("JobNumber").ToString();

Even though our job Number is an integer it is easier to store it as a string for this program because that is the format your filter query will want it in. 

View answer in original post

2 REPLIES 2

Justin_Baur
Star Contributor
Star Contributor

Since I was able to find this out on my own with a lot of trial and error I thought I would share the answer. 

Just declare a blank string that you would like to store your attribute value that you will get.

string jobNum = "";

Then

jobNum = args.Object.AttributeValues.Find("JobNumber").ToString();

Even though our job Number is an integer it is easier to store it as a string for this program because that is the format your filter query will want it in. 

Hi Justin,

thank you for coming back and letting us know that you resolved your issue. i can see this being useful in the not too distant future for us!