Variables always of type Object

  • 98 Views
  • Last Post 10 April 2020
  • Topic Is Solved
m.pessemier@faktion.com posted this 06 April 2020

Hi there, I seem to be running into the same problem over and over again. I'm working with datatypes such as doubles and List<string> but when I want to use these variables they always come out as Object or List<Object>.

For example: I read the files of a certain folder and put them in a list. When I want to read out the list to cast to a String array, it automatically reads out a List<Object> instead of a List<String> which means I can't use it in a join operation after my ToArray because I get an Object[] instead of a String[] back.

 

Same with the next example. I have a table and loop over each row. I read out the values of that row and place them in double variables. When I re-use these variables to compare in an expression, it always fails because I'm suddenly comparing objects instead of doubles. I tried solving this by manipulation data to cast an object to a double but it doesn't work.

 

How can I solve this problem?

 (This is the same for confidence)

 

List example:

Order By: Standard | Newest | Votes
alphonsa@intellibot.io posted this 08 April 2020

Hi Pessemier,

Please find the solution (screenshot below) on how to convert the
List<Object> to List<String>,
you can use Get List method from list connector by writing transform data as

 “Return Value.ToArray(Type.GetType("System.String"))”.




Generally, you don’t have to convert to double as it internally tries to convert, so you can use in decision or expression directly. We tried similarly (screenshot below) and don’t see any issue here. Please let us know if we are missing something here or you can have a double check in your automation as per the screenshot.




Thanks & Regards,

Alphonsa.K


  • Liked by
  • m.pessemier@faktion.com
m.pessemier@faktion.com posted this 10 April 2020

This was very helpful indeed, thanks a lot!

Close