Copying specific columns from one data collection to another data collection

deep.pro09

New Member
I have one excel workbook (abcd.xlsx) with 3 worksheets (x,y and z). x worksheet have some data in it and y,z worksheet are empty.
x worksheet:
name|age|married
john|21|yes
max|22|yes
david|32|no

y worksheet:
name|age

z worksheet:
name|age

Based on married status (yes or no), i want to update the y and z worksheet. For eg if married is "yes", then update the y worksheet and if married is "no" , then update the z worksheet.
Output
y worksheet:
name|age
john|21
max|22

z worksheet:
name|age
David|32

Is it possible to use data collection for such business logic? Is there any other alternative for the same?
 

VJR

Well-Known Member
Hi deep.pro09,

Thanks for providing a detailed description of the issue.
Yes you can certainly add some logic to achieve this.

Since you already have the data in a collection then do this-
At first filter your InputCollection for all Married = Yes
1523888757082.png

For the above stage a new output collection for all Married Yes entries
1523888784198.png

Then from the colMarriedYes, Remove the Married column from the collection.
Remember to use the same collection name (colMarriedYes) in the output parameter too.
1523888848322.png

All you now have is this data as below.
This can now straight away be dumped to your Sheet y using the 'Write Collection' action of the MS Excel VBO.
1523888895950.png

Repeat the above steps for the 'No' items by taking another collection colMarriedNo or you can even make use of 1 output collection if you never need the data contained in them after dumping it to the sheet.
 
Top