how to filter powerapp gallery with textinput, dropdown, and datepicker - filtering

I've been trying to add another dropdown and a datepicker filter on my gallery
what's the best approach to achieve this?
whenever I add the ticket closed filter, it just doesn't work
here's my code
SortByColumns(
Filter(
PortfolioAPP,
userddown.Selected.Value = CollectorName && StartsWith(
TitanCompanyName,
SearchComp_1.Text
) && StartsWith(
TitanCompanyContactName,
SearchContact_1.Text
) && StartsWith(
Title,
SearchTicket.Text
) && StartsWith(
ResolutionType,
ResoTypeDDown_1.Selected.Value
)
),
"TotalDebtGBP",
Ascending

You can pass many conditions to the Filter function and it will work by returning the items from your data source (PortfolioApp) that satisfies all of those conditions. For example, you can rewrite your expression as:
SortByColumns(
Filter(
PortfolioAPP,
userddown.Selected.Value = CollectorName,
StartsWith(
TitanCompanyName,
SearchComp_1.Text),
StartsWith(
TitanCompanyContactName,
SearchContact_1.Text),
StartsWith(
Title,
SearchTicket.Text),
StartsWith(
ResolutionType,
ResoTypeDDown_1.Selected.Value)
),
"TotalDebtGBP",
Ascending)
If you want to add another two conditions (based on a dropdown and a date picker), then you can add two more expressions:
SortByColumns(
Filter(
PortfolioAPP,
userddown.Selected.Value = CollectorName,
StartsWith(
TitanCompanyName,
SearchComp_1.Text),
StartsWith(
TitanCompanyContactName,
SearchContact_1.Text),
StartsWith(
Title,
SearchTicket.Text),
StartsWith(
ResolutionType,
ResoTypeDDown_1.Selected.Value),
TicketClosedDate = DatePicker1.SelectedDate,
AnotherColumn = YourOtherDropdown.Selected.Value
),
"TotalDebtGBP",
Ascending)
Update after comments: Since your data source is SharePoint, it seems like there is currently a bug in which filtering based on dates with SharePoint lists doesn't work. I don't know when this will be fixed, but there are a couple of workarounds that you can consider.
The first one is to create a calculated column in SharePoint that converts the date column into a text column, with an expression such as =TEXT(PlacementDate,"yyyy-MM-dd"). You can then compare it with the date from the date picker in an expression like
Filter(PortfolioApp, PlacementDateText = Text(DatePicker1.SelectedDate, "yyyy-mm-dd"))
This should work if your list doesn't have a many elements (up to 500-2000 rows) as delegation is not supported for calculated columns.
However, you also mentioned that you have >10k rows, so the previous workaround won't work. One other possible workaround is to have another "regular" text column that represents that same date value. You'll need to use some sort of script to backfill the existing values, and then use a flow to update that value every time a new row is added / modified. Not ideal, but that would work, at least until this bug is fixed.

Related

Format Column Header on pivot table as date in ag-grid

I am using a valueFormatter for my date columns in ag-grid (react) that looks like this:
columnTypes: {
"dateColumn": {
filter: 'agDateColumnFilter',
enableRowGroup: true,
valueFormatter: Blotter.formatDate,
enablePivot: true,
enableValue: true
}
}
where Blotter.formatDate is a simple formatter that outputs the date in the user's preferred format. However, a common requirement in my application is to build pivot tables using a date series so the date column ends up in the "Column Labels" section of the pivot definitions. When I do this, the date column header shows the full, unformatted date and is also not sorted in any particular order. How can I make it so that the column label formats the dates in a reasonable way and have them sorted incrementing from left to right?
Here's what I'm seeing:
The dates across the top are from the "Position Date" column, which renders like this when pivot is not turned on:
Thankyou,
Troy
I was stuck with the same problem. I finally found the solution.
You must set the keyCreator on you column definition
As Olivier mentioned you can use the keyCreator property for your purpose.
But be aware when you use it together with valueFormatter, it causes a strange behaviour in your Pivot.
Here a link to the official documentation where you can find out more
https://www.ag-grid.com/angular-grid/column-properties/
processSecondaryColDef
"This is a callback that gets called on each group definition":
processSecondaryColGroupDef
.
Using the method above you can resolve the problem.
I fixed the same issue in my project.
From the link:
// This is a callback that gets called on each column definition
processSecondaryColDef: function (colDef) {
colDef.headerName = colDef.headerName.toUpperCase();
},
processSecondaryColGroupDef: function (colGroupDef) {
if (colGroupDef.pivotKeys[0] === '2002') {
colGroupDef.headerClass = 'color-background';
}
colGroupDef.headerName = 'Year ' + colGroupDef.headerName;
},
};

How to create a drop down or multiple select filter in dashboard that will filter all worksheets?

I have null and non-null values in my dataset. I would like to create a drop down which will consist of -Display All, Null or Non-Null values. This should filter the dataset so that all worksheets in the dashboard are filtered out based on it. How shall I proceed?
A parameter will help you accomplish this.
Create... > Parameter > String > List > ["All", "Non-Null", "Null"]
From there, create a calculated field which references the parameter.
If [Parameter] = "Non-Null" Then
(If IsNull([Nullable Field]) = False Then 'Show' Else 'Hide' End)
ElseIf [Parameter] = "Null" Then
(If IsNull([Nullable Field]) = True Then 'Show' Else 'Hide' End)
Else 'Show'
End
Finally, place the newly created calculated field on filter and select only 'Show.' To filter all worksheets, right click on the filter and select Apply to worksheets > All using related datasource or specific sheets of your choosing.

How to use select syntax for group by field which is array in Dynamics AX

I have field Value in table finStatementTrans which is array.
How should I write select syntax with group by and sum by this field?
while select finStatementTable join DataClassParagraph,sum(Value) from finStatementTrans
group by finStatementTrans.DataClassParagraph
where finStatementTable.RecId == finStatementTrans.FinStatementTable_FK
&& finStatementTable.FinStatementTableParent_FK == 5637569094
{
info(strFmt(%1,%2",finStatementTrans.DataClassParagraph,finStatementTrans.Value[1]));
}
Is this correct?
sum(Value[1])
with this I can't compile.
As Aliaksandr Maksimau mentioned in his comment, aggregating array fields is not possible. Aggregations are only supported for integer and real data type fields.
See also X++ data selection and manipulation, paragraph select statements, last sentence.

How to select a row in kendogrid after filtering

I have a kendogrid. What I do is first filter it, which works fine.
After having it filtered, I want to select a specific row. I am sure I have the row in the result of the filter.
Example:
data = id=a1, id=a2, id=a3, id=a4, id=a5, id=a6
filter result:
id=a2, id=a4, id=a6
I would like to select the row a4.
First of all loop through the Grid's data which is currently displayed (i.e.
var arrayOfModels = $('#GridName').data().kendoGrid.dataSource.view();
next add the k-state-selected class to the row you want to make it selected
$('#GridName tbody [data-uid='+model.uid+']').addClass('.k-state-selected')
where model is the record from the arrayOfModels above which you need

MDX: Calculated Dimensions?

I don't know if this is possible or not, or if my limited knowledge of MDX is pushing me in the wrong direction...
The cube I'm dealing with has two different dimensions for dates, [Statement Dates] and [Premium Dates]. Further in the hierarchy of each looks like this:
[Statement Dates].[Statement Year].[2008]
[Payment Dates].[Payment Year].[2008]
For the business logic I'm implementing I need to do something like:
select
({ [Measures].[Commission] }) on columns,
({[Products].[Product Category]}) on rows
from [Cube]
where
(
IIF( [Products].[Product Category].CurrentMember.Name = "Some Category",
[Statement Dates].[Statement Year].[2008],
[Payment Dates].[Payment Year].[2008] )
)
So I need it to discriminate what dimension to use for filtering the year based on what product category is being used.
This parses ok and the query runs, but the numbers seem to suggest that the IIF statement is always returning false.
Because the WHERE clause gets evaluated first the .CurrentMember function in the IIF will only be seeing "All Product Cateogories". In which case the [Products].[Product Category].CurrentMember.Name will never be equal to "Some Category" as the only product category in context is "All Product Cateogories".
One possible work around would be to do a calculation like the following:
WITH MEMBER Measures.Commission2 as
SUM(
{[Products].[Product Category].[Product Category].Members}
, IIF( [Products].[Product Category].CurrentMember.Name = "Some Category"
, ([Statement Dates].[Statement Year].[2008],[Measures].[Commission])
, ([Payment Dates].[Payment Year].[2008].[Measures].[Commission]) )
)
select
({ [Measures].[Commission2] }) on columns
, ({[Products].[Product Category]}) on rows
from [Cube]
You could also do a scoped assignement in the calculation script in your cube to do this sort of thing.