Is there an easy way to create a dataTable variable of specific size with just ones?

Hey everyone,

I would like to create a data table of size mxn, where m = number of rows and n = number of columns, where every entry is a 1. Is there a simple way to do that?

Additional question: Is there also a way to put any number everywhere? E.g. instead of just 1s just 7s.

Kind regards! :slight_smile:

@muehlbauer157

use build datatable with the n no of columns which you want

and we can increase the no of rows by using add datarow

Depending on the dimensions:

  • build DataTable
  • done with essential actitivies (for each, add datarow)
  • LINQ

We would recommend to check also the Default setting from a data column as it can be exploted to set the initial 1 value

V2: EDITED: added Generate DataTable to the options
We can also create dyanmic CSV strings and feed it to Datatable generation by CSV Parsing e.g. with the Generate DataTable Activity

maybe to specify - i have to create many datatables which vary in size every time. sometimes it’s 3x1, then it’s 4x2, then it’s 8x1. The entries are always 1s.

Therefore I can’t always use build DataTable activity since I never know the dimension beforehand.

we can dynamize as we can setup in one loop the datacolumn structures
and in another loop we would populate

@muehlbauer157

columns can be added as many as you want in run time using add data column activity

rows can aslo be made increased using for each and add datarow

in addition to above also have a look at these approaches

But to conclude: yes We can dynamize Datatable constructions and do have multiple options / techniques for it

first of all thanks for all the input. :slight_smile: yes i know about add data column and add data row. yet what I’m looking for is sth like that (e.g. in python)

image

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