Using ngx-datatable, I need to find the next and previous row in the table - ngx-datatable

ngx-datatable doesn't seem to provide a way to know the next or previous record. It only multi-sorts visually. I've tried recreating the sort separately by matching the [sorts] array, but the table can still be in an unknown order. I tried forcing a hidden sort field at the end of the sort array for a predicable order, but changing the sort array in the onSortChange event doesn't force a resort. I need to find either the next/prev record, or a way to trigger a resort when a make a programmatic change.

Related

Preventing incomplete records from being added to table WITHOUT table change?

So I working on an Access form and ive noticed that when i dont fill out all the fields and close the form, the fields that i did fill out populate into my table as a sort of "incomplete" record which messes up my numbering increment system that i have going. Is there any way of discarding all data entered on form close without making certain fields required in the table properties? I dont want to do this because it gives a message when trying to close and i want to avoid that if possible
The issue of autonumbering incrementing, and that of not wanting to save record with missing fields or values are TWO HUGE different issues.
Try going to a new record, type in a few things, hit esc 2 times (or go to ribbon and use un-do and now exit form.
The record will now be blank and if you exit, then no record is created (however, the auto number will have incremented) So auto number incrementing and saving of records are two VERY DIFFERENT and separate things.
When you start typing into the blank new record on the form - the record becomes "dirty", and a auto number is incremented and assigned to that record.
if you don't want the record to be saved with missing things, then in the forms before update event, you can check for missing fields, or even bad or wrong values, and if you set cancel = true, the record will NOT be saved, nor created.
So, you don't need to set required in the table design. There are often ALL kinds of things you might want to check for. Say you might require first name or last name (one or the other - such things can't be done at table level. So you can have as complex record verification as you want. And as noted, in most cases, you can and would use the forms before update event.
However, preventing a blank record, or a record being saved with missing information? Sure, not problem - a common requirement.
The above has ZERO, but absolute ZERO to do with the autonumber issue.
Access will issue and set the autonumber as SOON as the first key is typed into that form. As noted, you can use undo, and upon exit, NO REOCRD will be created nor saved.
However, the autonumber created will be tossed out - and skipped. The reason for this is for multi-user operation. If two users move to a new blank record, then when one starts typing, the autonumber is assigned. (even if you don't save the record). when the 2nd user starts typing, they also get a autonumber. Now, if both users hit undo (or esc key), then both can exit, and you note that 2 autonumbers will have been skipped. As noted, access works this way so two users can't be assigned the same PK value when adding records.
As a result, autonumbers can NEVER be deemed to not skip. And of course what about deleting records - again, you have gaps.
Autonumbers cannot be used for say invoice numbers, or some kind of external value. Autonumbers can NEVER be assigned ANY more meaning then that of just some "random" like PK value. You can't use those numbers for external business use if such numbers are to say only be sequential without gaps.
If you need a business incrementing number, such as invoice, or job number or whatever? The you need to create your own column, and manage that incrementing in code. (such as assigning that number in the before update event - but as I noted, yo can also CANCEL that before update event for any old reason - including missing fields or even if this is a odd day of the week (any criteria that floats your boat can be used here, and thus when they exit you can prompt them and tell them that the record is incomplete. Or in those special cases, you can even let them exit without a save, but some kind of message probably is better.
So, if you don't want some incomplete record to be saved? Then put whatever you wish into the forms before update event - and set cancel = true (that event has a cancel option built EXACTLY for this purpose). However, that goal of saving, or preventing a record save has VERY LITTLE to do with the issue of not having gaps in the autonumber - that you can't control, and that you cannot prevent. (prevent gaps).
If you need some external business numbering system, you can't use autonumbers. In fact users should never even see autonumbers, and they are for you the developer to build relations between tables.
As such, these internal house keeping auto numbers cannot be used for external business process(s) that require some kind of sequential number without gaps, since that is not their purpose, and worse yet, you can't control or avoid gaps in such numbers anyway.
You can undo, but autonumbers increments means numbers will and are boing to be skipped as a normal operation of the database system.
Since that number is automatic and under control of the database system, and NOT you the developer, the you can only accept how it works and use it - but you can't change the behavour of that auto number. This applies to all and any database systems. In fact later versions of sql server will skip forward by 10,000 when you reboot.
If you don't want to save a record, then put in your code to prevent as such.
If you need a separate issue of some incrementing number for business use? Then add a column to the database and design the increment system to work whatever way you want - but you can't control the built in system, and its not designed with the goal you have here in mind anyway.

Eclipse Scout Neon row index in form data

I would like to know how to get row index from form data of the table field.
I would like to get row index from MyTableRowData and I can't find function for this.
Internally, the list of rows is stored as a List<AbstractTableRowData>.
When you invoke the method getRows() on an AbstractTableFieldBeanData, you get an array that is ordered in the same way as the corresponding list.
There is yet another method rowAt(int i) that gets you the row at index i.
The individual row data object, however, does not know its row index.
You may want to explain your use case. This could help to help you :-)

OpenRefine - Fill between cells but not at the end of the list

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.

Best way to handle multi-valued fields as a view/grid

In several notes applications, instead of handling related data as separate documents, if the size of the data is small (less than the 32k limit), I'll make several multi valued fields and display it in what I call a "List Panel". It's a table where each column displays one multi-value field. Since fielda(1) goes with fieldb(1) that goes with fieldc(1) there is a concept of rows. (I did a similar thing in my auditing routine discussed here )
It is always assumed that each field has exactly the same number of elements.
All the multi-value fields are then stored on the single document. This avoids several coding conventions that made my eyes bleed like having date changed, who changed it, new value fields for each field we wanted to audit. Another thing that this kept to a minimum was having to provide multiple fields for the same thing that locked you into a limit. Taxrate1, Taxrate2, Taxrate3, etc...
In my "Listpanel" the first column is a vertical checkbox. (One for each element in my lists) This is so I can select one item to bring up and edit, or select multiple values to delete "rows" or apply some kind of mass change to them.
What would be the best way to handle this under xPages to get this functionality? I tried making a table but am having the devil of a time to get the checkboxes to line up with their corresponding data items.
Views and dojo-grids seem to assume we're using a document for each row.....
This TableWalker may provide what you want http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Tutorial-Introduction-to-XPages-Exercise-23
It was created when XPages was all very new, so it's SSJS rather than Java. But if you're comfortable wiith Java, converting it probably won't be a challenge.
You could use a repeat control to display the values and build a table using the table row tags in the repeat. You would want to calculate the id of the checkbox to be able to take an action on that selected row. The repeat var would be just one of your multi-value fields and you use the index of the repeat to get the value for that row from the other multi-value fields.

Turning Off Grouping In ObjectListView Turns Of Sorting

I am struggling to find information on a lot of small issues I'm starting to come across since recently integrating the ObjectListView into my application. I must admit, I love the control and it takes a lot of work away from me by having the control pretty much do everything that I need.
However, amongst a few issues that I've come across thus far, one is the fact that if I turn off grouping for individual columns it no longer allows me to sort these columns.
For example, my ListView control has an ID, Summary, Location, etc., etc. I currently run grouping on the ID because I attach a unique footer against every ID and it looks good. But, when I click on Summary, or Location it then groups all items by Summary or Location and therefore I end up with the group header but no footer anymore because the footer no longer corresponds with the ID.
What I want to achieve is to allow the user to click on any other column, but still maintain the group by ID and thus keep the footer against each item. I only want the items to sort, not group, but as mentioned, when I turn off the grouping against each column, it turns off the sort function.
UPDATE
Basically, looking at the screenshot below, I want to be able to click on the Priority Column Header (for example) to sort the list of object by Priority, but still maintain the Group By Ticket (with the Group Footer details). And basically be able to click on any Column header to sort the list but keeping the grouping by Ticket.
I have intercepted the OLV_BeforeCreatingGroups event to add:
e.Parameters.GroupByColumn = Ticket_ID
This now seems to maintain my grouping by Ticket no matter what Column header I click on, but I now loose the sort functionality.
Try setting AlwaysGroupByColumn to be the TicketId column. That will do the trick :)
Second attempt:
Thanks for the screenshot. I think I understand what you want. You are hoping that clicking on the header will sort the groups themselves. That's not the default behaviour, which is to sort the rows within each group.
To do what you are asking:
Listen for BeforeCreatingGroups event and fill in the GroupComparer property on the event argument block. This comparer controls the ordering of the groups.
The default group order is based on OLVGroup.SortValue. So you could install a GroupFormatter delegate and change the SortValue for each group so they are ordered in the manner you want.
In either case, you will need to use PrimarySort and PrimarySortOrder to know which column the user last clicked.