How to pass a structure attribute's name to actions?

For example, this is my structure:


Report{

Name: "XYZ"

Agency:"ABC"

}


I need to pass as parameter >> "Agency"

I think we need some Information here. Is this an OutSystems structure? Or a JSON deserialize?

Are you just trying to pass the Text from Agency. Then I'd say you create a Text input and you would be able to pass it as "Report.Agency".

Jordan Welch wrote:

I think we need some Information here. Is this an OutSystems structure? Or a JSON deserialize?

Are you just trying to pass the Text from Agency. Then I'd say you create a Text input and you would be able to pass it as "Report.Agency".

Hi,

It is an Outsystems Structure.

I just want to pass the Attribute's Name as Input Parameter (Text) to a Server Action.

For Example:

I want to send "Agency" (which is the Attribute's Name) instead of the value of Agency.


To my knowledge there is not a way to get a structure attribute's label. However, defining a structure is all done design side and the attributes are referenced explicitly, it can't change while the application is running. This would better allow you to hardcode passing "Agency" as a Text string. 

What is the use case for this, might be able to give a better solution.

Christian Rivera actually you can do what you have requested but the solution isn't the prettiest (maybe there are other options). So with that being said, you can do the following steps:

  1. Use the JSON Serialize to serialize your structure
  2. Add the reference JSON_GetAttributes Action from ardoJSON extension(.xif)
  3. On JSON_GetAttribute action pass your serialized structure from step 1

And here you have as JSON_GetAttributes' output a set of pairs Name/Value, which one of them is "Agency"/itsValue

I hope this helps

Fernando Branco

Hi,

The attribute name is something hard coded so why not pass the text "Agency"? I know that if you change the name of the attribute this is not going to reflect but try to send the attribute name is just over complicating things.

Regards,

Marcelo