16
Views
5
Comments
Object reffering by []
Question

Hello,

I found such situation:

I need to reffer to an object. This part of code works:

ImportExcel.KUWE101

While this doesn't:

ImportExcel["KUWE101"]

How to overcome this? 

Essentionaly I need to implement sth like this:

ImportExcel["KUWE101 + someValue"]

To sume up my question, how to refer to the object if I don't know the value because it's dynamic?

Hi Adam,

AFAIK You won't be able to do this directly out of the box in OutSystems as you mentioned in your post. 

Perhaps the best option would be to serialise the ImportExcel object using the JSONSerialize block and perform this kind of operation in a JavaScript block within that flow. You should then be able to iterate/access the object node using the method mentioned above:

ImportExcel["KUWE101 + someValue"]

You could then pass this information to a generic output structure (eg. key, value).

Here is an example:

Please let me know if I understood your requirement correctly. This would be my first approach if I had the same issue.


Regards,

Heinri

Hello Adam,


Ye, Unfortunately OutSystems doesn't support dynamic properties.


The Heinri solution is the way to go if you are doing things client side. Not so if you need to this on server side, because you don't have the access to the Javascript.


If you need this on the server side I recommend you to check ardoJSON extension. Check the example below:

  1. Calling ardoJSON Listify without path (JSON result below the button). Then you can use ListFilter to search the property "key" with the value you want.
  2. Calling ardoJSON Listify with a path you can achieve similar result:
  3. Calling the ardoJSON Select with the path you want is probably the easiest way, it gives you the structure inside the path you provided. However the path is being made with dots it's fine, at the end it's a string and you can achieve what you want:

Best Regards,

Cláudio Rodrigues

Hi Adam,

That is very true, my suggestion will only for client side. Thank you for a great server side solution!

Kind regards,

Heinri

Rank: #32285

Hello, 

thank you for your reply. 

Do you know how to implement Henri's solution in traditional outsystems? Access to JavaScript is wierd and difficult in this version of outsystems.