I need to process the data from a table, what is the best way to step through the rows of a table programmatically?
const rows = table.getRows();
console.log('rows', rows);
Returns an array and you can iterate over it
Related
I have this data table that updates everyday with new data and the pivot table and slicer refresh automatically through a macro. Now, I wanted to write a macro to select the newly added slicer option and deselect the previous option, while not messing with the other earlier options that are also selected (multi-select slicer). The way I was going about it was to count the number of slicer items and then pass that index number to SlicerItems(i).select = True for the desired options. But it looks like you can only pass an array to data model based pivot slicer?
Here's my code
n = ActiveWorkbook.SlicerCaches("Slicer_Date").SlicerCacheLevels(1).SlicerItems.Count
'tried this
ActiveWorkbook.SlicerCaches("Slicer_Date").SlicerItems(n).Selected = True
'also tried this format
ActiveWorkbook.SlicerCaches("Slicer_Date").SlicerCacheLevels(1).SlicerItems(n - 3).Selected = False
Is there any workaround to pass the item number or any other way to accomplish this? Thanks!
Using ClosedXML to insert data into an existing Excel document, I need to move the part of the worksheet under a table down for a number of rows by inserting rows into the worksheet, not into the table.
Is there a way to find the row number N in the respective worksheet for a table row, which one gets e.g. by IXLTable.LastRow(), such, that IXLWorksheet.Row(N) will point to the row, in which the table's last row is contained?
Use IXLTable.LastRow().RowNumber() to get the row number.
For some reason my data validation list is not updating when adding a new column to the END of a table. If I had a column in the middle of the table then the data validation list DOES update. I also only want the last 2 columns (so Header2 and Header3) plus any new columns added. My data validations formula is =INDIRECT("Table3[[#Headers],[Header2]:[Header3]]")
Before Changes:
After I add Test1 and Test2 columns. As You can see Test1 is added to the data validation list but Test2 is not added. I would like Test2 added to the data validation list as well. Any ideas would be greatly appreciated.
For the record, if you use structured references you can create a range name that uses just
=Table3[#Headers]
in "Refers To" field. Further wrapping in Offset or counting columns is not needed. When a new column is added/inserted, the range name will adjust and the data validation will include the new value.
I'm looking to transfer a data column from one column to another after I click a button. I do not want to transfer the whole column, just rows where the name column is selected in a filter.
My train of thought was:
1) get a list of strings that are filtered
2) then loop through the rows of the table
3) check on that row if the name column is in the list
4) If so, then copy the data, if not leave the value in the copy
I've accomplished the 1) by creating a document property of the filtered values separated by commas. So "A, C" if A and C are filtered.
Table before data function call:
Table after data function call when A & C are filtered.
Have you tried a calculated column?
If ([Name] in ("A","C"),[Value],[Copy])
Add a multi line ctrl doc prop to replace "A","C" in the expression with ${aDocProp} that holds your Name filtered values on a text area.
I'm new in cassandra and hector.
I want to retrieve all columns of a row in Cassandra using hector.
After some exploration on web i got some sample codes, but it requires range or column name, like,
SliceQuery<String,String,String> query = HFactory.createSliceQuery(keyspace, ss, ss, ss);
query.setColumnFamily("MyColumnFamily").setKey("S001").setRange(null, null, false, 100);
QueryResult<ColumnSlice<String,String>> result = query.execute();
for (HColumn<String, String> column : result.get().getColumns()) {
System.out.println(column.getName() +"::"+ column.getValue());
}
Here i need to set Range in setRange() method which retrieves columns in this range. We can also set start and end in this method, but this will also give columns of particular range. If i'm not setting range then I need to give Column names as array.
Is there any way to get all columns of particular row?
I don't want to set range or column names, I just want all columns of a row. because in my application columns are not predefined.
Or is there any way to get total column count of a row so i can set it in setRange() method?
Thanks.
The way to do this for somewhat small rows is using the setRange() method exactly how it is being used in the example you pasted. If you set the start and end parameters of the range to null, then the range to fetch from is the entire row.
The only thing you need to account for at that point is the limit. In the example you pasted the limit is set to 100, so the query will not return more than 100 columns. You can set the limit to a very large number (larger than the possible number of columns you would have) if you want to always retrieve all of the columns in a row but this is not generally a good idea.
Instead you probably want to create a hector ColumnSliceIterator, for the range query, which will give you an iterator interface for the row and allow you to iterate through the entire row without querying for too many columns at once. See the example under 'Column Iteration' at the bottom of this page:
https://github.com/rantav/hector/wiki/Getting-started-%285-minutes%29