Hi does anyone know how to write a code for which the cells of an excel column is filled downwards with ascending numbers? Pls refer to the excel file if this is hard to understand
Book1.xlsx (8.4 KB)
is the request about on how to write a sequence from 1 to a particular number (e.g. 6 to an excel)?
- prepare datatable - build datatable activity - configure 1 col | dtResult
- use a for each activity | item | Enumerable.Range(1,6) | Typeargument: Int32
- Add dataRow activity | datatable: dtResult | RowArray: {item}
- finaly write the datatable to excel with a write range activity
instead of Enumerable.Range(1,6) we can dynamize it with a variable:
maxVal = 6
Enumerable.Range(1,maxVal)
Actually the numbers are used to indicate the number of forms in a month so they should be running in this format (see bold). I realized i can’t add the text in front of the datatable. Is there any other method this can be done?
Copy of Identifier No. tracking for forms.xlsx (14.7 KB)
not clear what is meant with this.
Ensure the datatable defines a string datatype for the datacolumn
edited flow from above
-
prepare datatable - build datatable activity - configure 1 col | dtResult
-
use a for each activity | item | Enumerable.Range(1,10) | Typeargument: Int32
- Assign activity: myVal= “ERWR/2020/05/” & item.toString.PadLeft(2,"0"c)
- Add dataRow activity | datatable: dtResult | RowArray: {myVal}
-
finaly write the datatable to excel with a write range activity
That means that when you told me to add the datatable for the running of numbers (1,2,3,4,…). Now i need it to be in such a way whereby (ERWR/year/month/1, ERWR/year/month/2, ERWR/year/month/3, …). However I cant just add text (ERWR/year/month/) in front of the numbered columns
maybe you cans share some screenshot on what you have implemented so far
This is what I’ve implemented so far. It only gives me the identifier number as 10, however i need it to be 1,2,3,4… for each column
Main (2).xaml (6.8 KB)
Identifier No. tracking for forms - Copy - Copy.xlsx (15.3 KB)
@Daryl_Tan
have a look here for the modifications:
Edits done:
- moved Add datarow into the for each Body
- changed For each typeArgument to int32
The provided RnD was good designed by for trying the implementation. As the add datarow falled out from for each looping so only the last value (10) was added to the datatable.