Set row index with ag-grid in Angular - ag-grid-angular

I am trying to create a table with ag-grid in Angular.
Is there a way to set the row index at this time?
Other than that I create a seq column and use a function to change the value. I'm sure it can be set as an option, but it doesn't seem to exist when I searched the documentation...
example image

Related

Type Script function to scroll to specific table index

I need help to write a function in type script,so that i can scroll to specific index in material table.
Lets say i have 100 rows in my table showing 10 items at a time. If i provide input as 50, table should be scrolled upto row no. 50.
I am using type script with my angular html code.
You can get all rows of table as array and then scroll to specific row by using index
const rows = document.getElementsByClassName("mat-row cdk-row");
rows[50].scrollIntoView();
Or you can use query selector
document.querySelectorAll(".custom-table .mat-row");
Here custom-table is your table custom class name. This way you can get specific table rows if you have multiple tables on a page

MySQL Trigger - Finding column names dynamically

When a table row is updated , I am getting the changed row as NEW object.
I need to get all column from this NEW row.
Is there a way to get all the column from NEW object, or I should manually access all the columns like NEW.id, NEW.name.
If a new column is introduced into the table for which I am writing the trigger, I need to manually come and add this column in my trigger.
Kindly please suggest me any ways to dynamically access all the columns from the row.

Is there a way of using the newly inserted rows id as a value in the rows column in MySQL in a simple way?

Is it possible to use the id of a newly inserted row inside the rows own column as a value in a simple way?
Or do I need to Insert it first, then then get lastInsertId, and then update the row?
There is no way to do that, you would need to do as you suggest and update the row again.
See: https://dev.mysql.com/doc/refman/5.6/en/information-functions.html#function_last-insert-id
I would note, however, that this is probably a bad idea.

Google Sheets Pivot Table Not Updating

I have a google app script which submits info to an organized sheet and would like to create a pivot table with the all information in the sheet. I can do this, but whenever I submit a new row of data to the sheet, it is not automatically included in the pivot table. I have to manually change the range of the pivot table every time I submit a new row of data. Is there any way I can make the sheet/pivot table automatically include the new row of data?
I worked around this issue by only specifying the column range.
For example, if you have row data in columns A to F, set the range of the pivot table to SHEET!A:F
If you add rows now, the new data in those columns will be added to the pivot table.
There is a way. I did exactly that 3 years ago on Sheets.
If you are submitting the new rows using Google Forms, then there is no way.
If you try to programmatically update the range, there is no way either because named ranges need to be deleted then re-added, causing #REF on the pivot.
Now for the good part: If you are adding the new row with a script, do not append it to the end. Instead, keep a fake row at the end (with zero values so pivot is not affected) and insert the new row just before it. Your range (named or not) will update.
Even for the Google Forms case, you might get it to work by pre-adding all blank rows to the response sheet and make the named range include the blank ones too.
I encountered the same problem with the Google Sheet linked to a form. How I solved it:
Edit the Pivot table range to include the empty row after the last row in your sheet.
If your pivot table data range is 'Sheet Name'!A1:S100, change it to 'Sheet Name'!A1:S101.
Add a filter to your pivot table for a column (present in the data range) that will never be blank and set the condition for this column - 'Is not empty'
If you have a column 'Timestamp' (and you're sure it will never be empty), then add this column to the filter, select 'filter by condition' and set the condition to 'Is not empty'.
These steps will filter out the last (empty) row. When you will add a new row to your data, the pivot table will update automatically and you won't have to update the data range again.
In my case what was interfering were the fields in the Pivot's Filters section (highlighted in red below).
Make sure you test without any filters... see if it works. Then add your filters one by one and play with the pivot. Probably the filter(s) is\are influencing the pivot to not update.

SQL Update with Variable as Parameter

I am working on a stored procedure in MySQL to update a row in a SQL table. What I have is a table where several of the columns are named incrementally. EX: Page_1, Page_2, Page_3....etc.
The data stored in these locations is updated at different times and I have another column to store the number of times the row has been updated. The count variable gets incremented each time the procedure runs and that allows me to utilize it's value in keeping track of where the next update of the data should take place.
From my research I keep finding solutions utilizing "Dynamic SQL." I do not understand how to utilize this to resolve my issue.
I want to pass a variable in to an update statement as the column name.
The code I currently have is as follows.
SET COUNT = COUNT + 1; -- modify count from count column
SET COLUMNLOCATIONVARIABLE = CONCAT('Page_' , COUNT); -- concatenate the count with the column "Prefix"
UPDATE Table
SET COLUMNLOCATIONVARIABLE = INPUTVARIABLE --Use the concatenated statement as the column name and update it with input data
WHERE mainID = INPUTID;
If anyone could explain to me how to pass this variable in as a column name using Dynamic SQL or another solution utilizing non-dynamic SQL I would appreciate it.
Thanks in advance.
This isn't the way to use a database. Create a new table for your Page_* columns, linked to the main table by an identity, with a page number column. Then you can update and include as many pages as you need, addressed by the main identity and the page number.