Date Format, Number Format, Data Table

Hi Guys,

I have a two inputs mentioned below,

Date: 12/08/2023
Row Range: 1-3

How to get a output as mentioned below in a data table

image

Need a help on this to solve.

Thanks in Advance…

Hi @manikandan.murugan

Use this syntax in Assign:

Output = dt.AsEnumerable().Where(Function(row) row(0).ToString() = "12/08/2023").Select(Function(row) row(1).ToString()).FirstOrDefault() + "-" + dt.AsEnumerable().Where(Function(row) row(0).ToString() = "12/08/2023").Select(Function(row) row(1).ToString()).LastOrDefault()

Hope it helps!!

Hi @manikandan.murugan

=> Input:
image
Output-> dt

=> Use the below syntax in Assign:

Output = dt.AsEnumerable().Where(Function(row) row(0).ToString() = "12/08/2023").Select(Function(row) row(1).ToString()).FirstOrDefault() + "-" + dt.AsEnumerable().Where(Function(row) row(0).ToString() = "12/08/2023").Select(Function(row) row(1).ToString()).LastOrDefault()

Hope it helps!!

hi @manikandan.murugan can you rephrase your question? what’s your input? what’s your ouput?

am I right to assume, that…

input:
date: 12/08/2023
row range: 1-3

output:
dataTable as shown in the picture

in other words: if you provide a date + a row range you want a dataTable which looks like in the picture. yes/no?

cheers

Hi @Julian_Muhlbauer

I have a two input variables like

SingleDate = 12/08/2023

RowRange = 1-3

I need a output as

Hi @manikandan.murugan

I have a workflow for this:
=> Use below syntax in Assign activity:
Assign (DataType = System.String) -> "12/08/2023"
Assign (DataType = System.String) -> "1-3"
Assign (DataType = System.Int32) -> CInt(rowRange.Split("-"c)(0))
Assign (DataType = System.Int32) -> CInt(rowRange.Split("-"c)(1))

=> Use below code in Invoke Code:

dt = New DataTable()
dt.Columns.Add("SingleDate", GetType(String))
dt.Columns.Add("SingleDataRow", GetType(String))

' Generate rows using LINQ
Dim rows = Enumerable.Range(startRow, endRow - startRow + 1).
    Select(Function(row) New Object() {inputDate, row.ToString()})

' Add generated rows to the DataTable
For Each row In rows
    dt.Rows.Add(row)
Next

Invoked Arguments:

=> Write dt to excel using Write Range Workbook.


Sequence5.xaml (10.9 KB)

Hope it helps!!

2 Likes

Hi @Parvathy

Really thank you so much and it’s working

Regards,
Mani

1 Like

You’re welcome @manikandan.murugan

Happy Automation!!

1 Like

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