In custom text facet I want to check value of previous row's cell.
I tried rows[row.index - 1] with no result.
google refine does not allow you to get the previous row directly. You may wants to have a look at the fill down option but not sure it will help with your project: http://googlerefine.blogspot.ca/2012/03/fill-down-right-and-secure-way.html
Related
Objective
I have an excel sheet that has 10 rows. Now, I want to select rows 5 and 6 only.
What I tried
I am getting the rows to set limit in the Excel Input -> Container, but using limit I am only getting rows smaller than input limit. So please anyone tell me how can I get the above condition.
Updated
specified start row = 5 in Sheets Tab
Without specified start row
First of all in content section you can specify the filter and it is working perfectly fine, I have checked.
For achieving your output you can simply use filter rows step, specify the values you want to in values condition.
With the Excel input step, on the Sheet tab you can specify a range. Tell you want to start on row 5, col 1. Tell also on the Content tab, that you do not want a header, and a limit 2.
This should work. However, the answer is a bit academic, and I would suggest #Working Hard's answer. Read every thing, then use a Filter step. In this step you can put more than conditions, like row=5 or row=6, or like row>=5 and row<=6. To do this, put the first condition, then click on the small green + on top right and put the second condition. Afterwards, you can click on the AND to change it in OR (among others).
I want to use a macro to filter columns in a table. I want to filter for values that are higher than a value I want to put in cell, to be able to easily change the filter. Does someone have a trick for doing this with vba?
Many thanks, Bram
Record a macro whilst filtering a table on a column value. You would right click on the table column header of interest whilst recording the code and select Number_Filters > Greater Than and enter your desired number. That would give you the outline code. You can then amend the code to pick up the desired value from a specified cell. If applying filter to multiple columns record macro whilst doing this process over several columns.
Thank you for you answer. I tried this already, but I could not get the macro to pick from a specific cell. If I stored the value of the specific cell under as 'value' and put that in the outlined code, it would just do Greater Than value.. DO you have shortcut for this?
Thanks!
I get an array of rows/columns within a RANGE using "GET https://sheets.googleapis.com/v4/spreadsheets//values/".
It has no information on row Id though.
Is it possible to retrieve a row id ? It'll be helpful to update/delete the specific row even if the row number changes .
There is no way to do this unfortunately — which is a bit of a shocker, to be honest. I'm not sure why Google would decide not to have this feature implemented in their API. A user could add a column to the spreadsheet in question and make the values unique, but that is exactly the point of the index column inherent to the spreadsheet.
Therefore, my answer is that you just ad a column with a header named "unique-id" and then each cell under that column uses the formula =ROW() which will return the value of that row. Then, you can access the value of that column via the Google Sheets API — either list-based feed or cell-based feed. However, if you use the list-based feel, and modify the row, the formula gets altered to just the calculated value. So, it's really a moot point to do it this way if you intend to modify rows using the list-based (rows-based) feed.
There is no such thing as a row id in the v4 API.
If I'm referencing the correct Google Sheets API, which has confused me at times, you can use getRow() or getRowIndex(), no?
getRow()
getRowIndex()
=row()
Returns the row number of a specified cell.
https://support.google.com/docs/answer/3093316?hl=en
best regards
I have a list of stock prices for several stocks. Some of the values are missing due to weekends, holidays and probably other reasons.
The gaps are not consistent. Some are two days and some are more than that.
I want to fill the gaps with the last known value but not at the end of the list.
I have tried in Excel to test a few cells below and if it's now empty, do the fill. The problem is that due to the inconsistency of the gaps, it's a tedious task to change the function for all the cases.
Is there a way to test for the end of a list?
UPDATE - added a screenshot.
See this screenshot. I want to fill where the blue dots are. The red dots are at the end of the list and I don't want to fill those cells.
I am looking for a way to detect the end of the list and stop the filling when the end is detected.
I think this is pretty difficult in OpenRefine and probably a different tool would work better. The main issue is that OpenRefine does not offer the ability to easily work across rows so 'summing a column' (or part of a column) is tricky - this is mentioned in https://github.com/OpenRefine/OpenRefine/issues/200
However, you can do this by forcing OpenRefine in Record mode with the whole project containing a single record. Once you've done this you can access all values in a column using syntax like:
row.record.cells["Column name"].value
This gives an array of all the non-blank values in the column. Since this ignores blank values, in order to have a true view of the values in the column you have to fill in blank cells with a value.
So I think you could probably achieve what you want as follows:
For each column you are going to work with do a cell transform to put a dummy value in empty cells - e.g. if(isBlank(value),"null",value)
Create a new column at the start of your project and put a single value in the very first cell in that column
Switch to Record mode
At this point you should have a single 'Record' in your project - e.g.
You can now access all cells in a column using syntax like row.record.cells["Column 1"].value. You can combine this with 'forRange' to iterate through the contents of this array, using the row.index as the marker for the current row.
I used the following formula to add a new column to the project:
with(row.record.cells["Column 1"].value,w,if(forRange(row.index,w.length(),1,i,w[i].toNumber()).sum()>0,"a","b"))
Then...
Change back to 'Row' mode
Remove the 'null' placeholder from the original column
Create a facet on the 'fill filter' column
In my case I filter to 'a'
Use the 'fill down' option
Remove the filter
And remove the 'record' column
Rather a long winded way of doing it to say the least, but so far I've not been able to find anything better while not going outside OpenRefine. I'm guessing you could probably compress steps 5-11 into a single step or smaller number of steps.
If you want to access the array of cell values using Jython as suggested by iMitwe you need to use:
row["record"]["cells"]["Column 1"]["value"]
instead of
row.record.cells["Column 1"].value
(step 5)
I am doing this on the top of my head, but I think your best chance my be using the fill down option in record mode:
first move your column to the first column and switch to record mode.
then use the following GREL: row.record.cells["data"].value[-1] where data is the name of your column
The [-1] will take the last value and fill the blank. For the case with the red dot, since there is no value it should remains empty. Let us know how it goes.
Unless there's something I am missing or not seeing...
I would have just sorted reverse (date ascending) on the Date column, then individually use Fill Down on each column, except for that last column where you could then use a Date facet on your column Date to specify the exact Date range you wanted to work with, then fill down on that last column, then remove the Date range facet.
I have a few reports built using Report Builder 3 for MSSQL 2008 Reporting Services.
Some fields in my report are showing "#Error", instead of this I want to show only a simple "-". Is there any built-in function or custom code to overcome this?
I'd still really like to see your formula but you seem determined not to show it, so I'll take a wild stab at answering without it. I imagine that you are doing something like dividing the field on the current row by the field on the previous row. However, this would give you Infinity on the first line rather than #Error so there is something else going on. But let's run with this anyway since we don't have your formula.
The most common way to solve this is to check for Nothing being returned for the Previous function, usually indicating that you are on the first row (assuming your field always has data). This has the advantage of also working on fields that are not guaranteed to have a value.
=IIF(IsNothing(Previous(Fields!MyField.Value)), "-", Fields!MyField.Value / Previous(Fields!MyField.Value))
Here is another way you could do it using the row number, which will always check for the first row regardless:
=IIF(RowNumber(Nothing) = 1, "-", Fields!MyField.Value / Previous(Fields!MyField.Value))
This assumes that the error is being caused by the Value formula and not by some other mechanism such as applying an expression to other properties like Format, Color which is invalid when there is no previous row.