Write Datafile to Excel Range

I built a datatable with 5 columns. Throughout the execution of my process, there are times when I add to the data row. The items that I am adding are elements from an orchestrator queue, and I am sending in an array such as:

{({TransactionItem.SpecificContent(“Customer ID”).ToString, Customer_ID}),
({TransactionItem.SpecificContent(“Amount”).ToString, Amount}),
({TransactionItem.SpecificContent(“Original Trace”).ToString, Original_Trace}),
({TransactionItem.SpecificContent(“Return Code”).ToString, Return_Code}),
({“Customer not Found”, Exception_Reason})}

At the end of the process, within an Excel Application Scope, I have a write range that writes the datatable. However, when the excel is viewed, it is as such:
Screen Shot 2020-05-19 at 9.15.03 PM

Is there a step I am missing to get the actual date pushed to the excel file?

Hi @etaulton

I imagine that the data type for the columns in your table is an string array (System.String), that’s why you are getting that results on Excel.

Unfortunately, you cannot change the DataType after the DataTable is filled with data; but you can implement the following:

  1. Create a new DataTable with the expected output
  2. Add an for each activity
  3. Import each row into your output DataTable using a proper cast of data type

Hope it works for you.

Regards,

Andres Tarazona

1 Like

The data type for my original datatable is String. Also, the data I am pulling form the transactions are being converted ToString. Guess I am not following what you are meaning my change the datatype? Are you suggesting that I need two datatables?

@etaulton I guess you’re sending the Data to the Queue in the Wrong format, Can we take a Look at the Queue Data.

So this is how I am sending the data to datatable, using Add Data Row to the datatable. The above calls are the same I use when I log the same data and it comes in the log as expected.

This data here is the same that I am attempting to send to the datatable and then to an excel so I can email the exceptions out.
Screen Shot 2020-05-20 at 6.48.22 AM

@etaulton So when you log the same data you get it as how you needed it ?

here is my datatable

Yes, here is my log message:

"No items for customer: Customer ID - " + TransactionItem.SpecificContent(“Customer ID”).ToString + ", Amount - " + TransactionItem.SpecificContent(“Amount”).ToString + ", Trace - " + TransactionItem.SpecificContent(“Original Trace”).ToString + ", Return Code - " + TransactionItem.SpecificContent(“Return Code”).ToString

@etaulton Can you use a Message box with the value TransactionItem.SpecificContent(“Customer ID”).ToString and check what is the Value it returns ?

when I run a message box with just one value, it shows the value as expected. When I run the same message box with the array of values, is shows the following.Screen Shot 2020-05-20 at 6.55.42 AM

So the problem has to be with the array…

@etaulton What Expression did you use in the message Box ?

First message box is just the transactions
[TransactionItem.SpecificContent(“Customer ID”).ToString]

Screen Shot 2020-05-20 at 7.08.15 AM

Second is full array from above

Screen Shot 2020-05-20 at 7.08.46 AM

Within the array, is there another way to assign the columns instead of using the column name?
or to just leave the column names out?

@etaulton Ohh yes. I Couldn’t notice it in the first post :sweat_smile:, There is no need to Add {} for each Item or Can you tell me why do you do this :
{TransactionItem.SpecificContent(“Customer ID”).ToString, Customer_ID}

Why TransactionItem.SpecificContent(“Customer ID”).ToString and Customer_ID ?

1 Like

:open_mouth:
Pretty sure I saw that in an example, could not have created on my own. lol

so I can do just this? Trying now
{(TransactionItem.SpecificContent(“Customer ID”).ToString), (TransactionItem.SpecificContent(“Amount”).ToString), (TransactionItem.SpecificContent(“Original Trace”).ToString), (TransactionItem.SpecificContent(“Return Code”).ToString), (“No Items”)}

1 Like

@etaulton Yes, Also I don’t think you’ll be needing the () for each item. Since there are 5 Columns, you’ll need to have 5 items in the array or less than that for it to work.

Screen Shot 2020-05-20 at 7.26.43 AM

Think that fixed it. Going to run full process. MUCH APPRECIATED!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.