Material-table CustomSort doesn't work with Dates - reactjs

I receive a column from api that contains Dates + _number (example: "20/12/2019_1" as a string). The sort function will group counting data as a string and not as a Date column. Which means i need to do a customSort.
So i created a function to transform that string into a Date object, but when i return the value nothing happens...
Columns:
utils.js:
The formatLot function is working as expected since i wanna Sort value as type Date.
Result from formatLot function:

You are using the custom sort incorrectly.
As seen in the docs, you have to return the comparison of two dates as a number, but you are only returning the date object.
Change it to and it will work:
customSort: (a,b) => formatLot(a.test).getTime() - formatLot(b.test).getTime()

Related

How to filter records between timestamps from information_schema.warehouse_load_history()

I want to filter the records between timestamps from information_schema.warehouse_load_history() somehow below query is returning the empty result.
Query
select date_part(epoch_millisecond, convert_timezone('UTC', END_TIME)), WAREHOUSE_NAME, AVG_RUNNING, AVG_QUEUED_LOAD, AVG_QUEUED_PROVISIONING, AVG_BLOCKED from table(information_schema.warehouse_load_history()) where date_part(epoch_millisecond, convert_timezone('UTC', END_TIME)) >= 1668081337659 and date_part(epoch_millisecond, convert_timezone('UTC', END_TIME)) <= 1668083015000
The important point here is, the filters in the WHERE clause will be applied after the warehouse_load_history table function returns a result set. This rule is valid for any information schema table functions (ie query_history).
The function accepts DATE_RANGE_START, DATE_RANGE_END and WAREHOUSE_NAME parameters.
If an end date is not specified, then CURRENT_DATE is used as the end of the range.
If a start date is not specified, then the range starts 10 minutes prior to the start of DATE_RANGE_END
So your query only returns the last 10 minutes of data for all warehouses. Your WHERE filter is applied to this returning data.
In short, you should use the filters of the function first (as I said, it's the same for all information schema functions), and then you should use the WHERE clause for additional filters.
You might be using that wrong, the dates are a part of the date function itself, no need to add a where clause outside of the table function itself!
For reference: https://docs.snowflake.com/en/sql-reference/functions/warehouse_metering_history.html
Code from ref:
select *
from table(information_schema.warehouse_metering_history('2017-10-23', '2017-10-23', 'testingwh'));

Power Automate - Filter Array with parameter variable

Power Automate - Filter Array
Filter array will look for numeric date value from List Rows Present. It will then email the results in a table via email.
This query works …
#and(equals(items()?[‘Date’], ‘44825’))
But replacing the forced ‘44825’ with a variable does not.
#and(equals(items()?[‘Date’], variables(‘DateNumber’)))
DateNumber is an int variable that contains 44825. Flow shows it is in variable as expected but the filter is not doing what is expected.
Not used much of this before so am thinking the variable function is not correct

Passing parameters to an invoked pipeline in Azure Data Factory

I am trying to extract a month and year value from an array, then pass them as variables to an invoked pipeline.
I am using the following code to extract the year and month parameters in the dynamic content pane (date is in yyyy-mm-dd format).
Year:
#variables('DateRange')[substring(item(),0,4)]
Month:
#variables('DateRange')[substring(item(),6,2)]
But it is not working because it is trying to substring the index number rather than the array content. What syntax would I use to substring the values in the array, via for loop?
Pass the array variable to ForEach activity.
Add the execute pipeline activity inside the ForEach activity.
Then you can use your expression to substring the current item and pass as parameter values.

How to use NPOI to get user defined format from a cell in xlsx file?

Background: I have a Date cell with the following user defined format ggge"年"m"月"d"日". However, if I call cell.CellType on this cell, the return value would be Numeric.
I need to distinguish it from other Numeric cells, but DateUtil.isCellDateFormatted(cell) returns false in this case (I believe it is because this is not a built-in Date format).
So I'm thinking if I can get the format of each cell, I can use it to determine if a cell is a Date cell or not. However, cell.CellStyle.DataFormat would only return a number code. Is there any way to get the format ggge"年"m"月"d"日 from NPOI's ICell object?

Converting to Datum type in PostgreSQL

I see that the fetchfunc is used to access the column values of the sample rows fetched for statistics collection. The function returns a Datum. Individually when we know of the datatype, we can use the functions like Float8GetDatum Int16GetDatum and so on to convert to Datum type.
My problem is:
Input : a column in a relation and a valid value that the column can take.
I have to find the datatype of the column and based on that, I need to use the right function to convert the given input value to the Datum value to be stored internally.
I am very confused on how to go about this in postgreSQL.

Resources