cancel
Showing results for 
Search instead for 
Did you mean: 

Dealing with nested data items, possible?

ShankulJain
Level 2
Hi All.

I wanted to know if there is any way we can deal with nested data items. I have a data items of text type which has value inside it which is also query statement. So instead of passing on the variables name I wanted to pass the value of the data item directly.

Example : Consider a data item of text type named as "ABC" and consider a collection named as "Collection 1" with columns A,B and C

Now ABC contains value [Collection 1.A]&[Collection 1.B]. I wanted to use this value inside ABC to fetch the data from "Collection 1.A" and "Collection 1.B". Is there a way to do that?

Also I cannot fetch the value directly using the statement inside ABC because the variable is populated using an external user. So today he wants to use A and B columns and tomorrow he may need B and C or A and B and C or just B. Therefore the value inside ABC is dynamic.

Is there a way to do this?

------------------------------
Shankul Jain

------------------------------
2 REPLIES 2

Hi Shankul ,

Might be i am not understand your question but trying to provide ans as per my understand.

Q - Now ABC contains value [Collection 1.A]&[Collection 1.B]. I wanted to use this value inside ABC to fetch the data from "Collection 1.A" and "Collection 1.B". Is there a way to do that?
A -
1.Drag and drop calculation stage
2.In calculation expression write [Collection 1.A]&[Collection 1.B] & Drag and drop data ABC item in store result.

Q.- Also I cannot fetch the value directly using the statement inside ABC because the variable is populated using an external user. So today he wants to use A and B columns and tomorrow he may need B and C or A and B and C or just B. Therefore the value inside ABC is dynamic.
A - Suppose requirement is for EFG column which you are getting from data item (You have to extract data using left and len - to get column name)
 
1.If column requirement is changing then use get collection fields,it will provide you collection header name and you have to validate this column name with requested column name.
2.If column name match then you can direct use [Collection 1.A] ( Extracted column name from point A )

Thanks



------------------------------
Nilesh Jadhav
Senior RPA Specialist
------------------------------
Nilesh Jadhav.
Consultant
ADP,India

AndreyKudinov
Level 10
So you basically want Eval(ABC)?
In general it depends on specifics of your task, but let's say you have a collection dt with any fields (let's say a,b,c,d..) and they are all of type string and you have data item ABC with a text value like a+b+c that you need to apply to all rows, then you can create a code stage​:

in: dt([Collection 1]), expr([ABC])
out: dt_out([Collection 2])
Code:
DataColumn exprColumn = new DataColumn();
exprColumn.DataType = System.Type.GetType("System.String");
exprColumn.ColumnName = "eval";
exprColumn.Expression = expr;
dt.Columns.Add(exprColumn);
dt_out = dt;

You'll have result in [Collection 2.eval].

There are other ways to do this, but it's hard to guess without more details. Maybe even use https://eval-expression.net/

p.s. Full featured eval() if often a bad thing, because if you eval everything user gives you, he might as well send you "format c:" 🙂
------------------------------
Andrey Kudinov
Project Manager
MobileTelesystems PJSC
Europe/Moscow
------------------------------


------------------------------