Convert Fetch result from Dataservice to a datatable and present it in table/Custom List

Hi

How can I convert the dataservice lookup to a datatable. The use case is to fetch a list of records from the dataservice, the user approves or deletes the rows and use the remaining rows as an output in a queue item or to a process.

Lets say I have 5 saleslines stored in the Dataservice, I fetch the lines from the condition “salesnumber” and present them in a custom list, the list contains a button that when pushed deletes the line in the datatable.
When all the lines has been either deleted or accepted by the user, the datatable is either converted to a string or used as input to a process afterwards.

Does it make sense?

@Michaeljep

This makes sense,are you facing any specific issue implementing it?

cheers

Yes, a bit.

How can I convert the output of the fetch to a datatable, preferrably with columns of my own choosing. the dataservice contains 5 colums, but the datatable output could be enough with only three of the five columns.

@Michaeljep

you can use vb expression to convert the listsource or datasource data to datatable and use it

cheers

Can you guide me in the right direction, how would that expression look like?

Any help and guidance would be greatly appreciated.

Please refer the examples here to get started

Thank you for the links, however it only goes from DT to listsource, not the other way around. So it doesn’t help me much in this matter.

Hi Anil

I’m stuck here, so hope you can help me.
How do I convert the Fetch (listSource) into a datatable?

Hi Michael,
I’m not sure if its possible to convert entity to datatable. but you can pass the datarow or datatable into a process as object. then in the studio, in_object.toString will give you the datarow or datatable as string in json format.

Depending on the complexity of the table, you could build the table using BuildTable function within the app.
Apps - Custom VB functions (uipath.com)

OR… if you are already updating the entities, you might just need to tell the robot which entity to look in your process.

Not sure if any of these make sense. Post back and let us know what you are doing.

Cheers.

Hi Leo

My usecase is I would like to use the data inside the App without involving the Dataservice too much.

I would like to be able to display the result in a list og custom list, and being able to either delete each of the the lines or add additional lines to the list and ultimately use the entire list as input in a queue item for further handling.

Basically what Im trying to achieve is;
A salesorder is stored in Dataservice including, lets say it has two sales lines
These two saleslines is shown in Apps as a part of the shoppingbasket.
The user can keep the two lines and add more lines to the shoppingbasket OR the user can delete either of the lines before adding more lines to the order.
When the order is done and payment has been received the entire basket is stored in a queue item for later handling.
Today I’m using “lists” to achieve it, it works perfectly if it’s only a matter of adding, and not correcting the existing lines.

I would like to use the data inside the App without involving the Dataservice too much.

why use it at all? start to finish with datatable.

Today I’m using “lists” to achieve it

can you share a sample of what the data looks like? Is it a list? or is it a table?

set your datable/list to an app variable and use the app variable as datasource. then you can add/remove rows/lines to the app variable and pass the app variable to your robot for processing.

Hi

Overall I’m trying to create a webshop solution with a shoppingbasket.

I’ve succeded with all new orders, but the issue is when there is prebooked orders that needs corrections.

On pageload I initialize two empty lists (SoldItemsList and OrderTotalDouble)
image

The user has the possibility to choose a customer from a table in the top of the page, or create a new customer.
on row selection a lookup to dataservice is performed to check for already existing orders.

Flow (No existing orders)
The customer is chosen and the items to be sold is added to the lists by clicking two buttons + and -
A few of the items are shown like below;
image

clicking + performs these actions

image

Removing the item again by clicking -

All of the above works fine, the issue is if there are presold any items and the user should add or correct the already sold items.

Today I add a predefined line with the amount and a fixed name, and not the acutal products to the list.

I would like to be able to take the presold items from the fetch result from the Dataservice and display them in a custom list, and upon clicking + or - add or remove items to the custom list
And when done take the whole list of items, both new and old items and add them to a queue item so the robot can pick up the queue item and process the items afterwards.

I would like to have a datatable that looks like this
Itemnumber, Price, quantity
Itemnumber, Price, quantity
Itemnumber, Price, quantity
etc
which is presented as a custom list including the three columns and the +/- buttons
And lastly a sum of the price column to be able to present the total order amount.