Power Apps Gallery Filter based on two values - powerapps-formula

I am busy creating my first power app and have hit a snag when trying to filter a gallery (SharePoint Linked) based on multiple values. I have three formulas for now as follows:
Filter([#'Demo Stock']; StartsWith('Part Number'; txt_ItemSearch.Text)
Filter('Demo Stock';Warehouse.Value=WarehouseFilter.SelectedText.Value)
Filter('Demo Stock';'Item Status'.Value="Available")
Each of these work independently. What would the syntax be to use all of these filters together?
This does not work:
SortByColumns(Filter([#'Demo Stock']; StartsWith('Part Number'; txt_ItemSearch.Text);'Demo Stock';Warehouse.Value=WarehouseFilter.SelectedText.Value;'Demo Stock';'Item Status'.Value="Available");"Part Number";Ascending)
Thanks,
Steven

This turned out to be the solution. Not sure if its the most elegant but it works.
Filter([#'Demo Stock']; StartsWith('Part Number'; txt_ItemSearch.Text);(Warehouse.Value=WarehouseFilter.SelectedText.Value);('Item Status'.Value="Available"))

Related

Data factory SAP BW

I'm trying to use the Data Factory in Azure to export data from a SAP BW. The connection is working, and I'm able to get data. The problem is how I'm getting the data. The picture describes the issue pretty well.
Has anyone encountered something similar? Any tips on how to approach this issue? Any help is greatly appreciated!
Query like:
SELECT
[Measures].<<Measure>> ON COLUMNS,
NON EMPTY
{<<Dimension>>.MEMBERS,
<<Dimension>>.MEMBERS} ON ROWS
FROM <<Cube>>
Picture:
https://i.stack.imgur.com/9Gxfh.png
Best regards,
This is how your query should look like.
select Measures.Value on columns,
nonempty
(
DimPlan.Plan.Plan,
DimCategory.Category.Category,
DimProduct.Product.Product
)
on rows
from YourCube
Looks like you are getting the ALL members of each hierarchy coming through into the results.
Very similar to MoazRubs answer but avoiding needing to use the NonEmpty function - you can simply cross-join the hierarchies via the * operator:
SELECT
Measures.Value ON 0,
DimPlan.Plan.Plan.MEMBERS *
DimCategory.Category.Category.MEMBERS *
DimProduct.Product.Product.MEMBERS
ON 1
FROM YourCube;

Does Saiku Analytics Plugin support 'Style' Attributes on Format String?

I am trying to apply some color formatting on my results using Saiku Analytics, without success. I tried everything, following the following recommendations to apply formatting in the Schema .xml
http://forums.pentaho.com/showthread.php?173272-Changing-Color-of-measures
http://forums.pentaho.com/showthread.php?73935-Calculated-Member-Format-String
as well as directly trying to apply custom format on the calculated members menu in Saiku Analytics.
Mondrian Documentation reads:
"The format string can even contain 'style' attributes which are interpreted specially by JPivot. If present, JPivot will render cells in color."
Apart from that, I haven't been able to find any evidence that Saiku supports 'style' as well. Any ideas?
EDIT:
Following the advice of this post
https://groups.google.com/a/saiku.meteorite.bi/forum/#!topic/user/Gb4AGqU87GY
I managed to apply formatting on my fields by changing my schema.
My calculated measure is the following:
<CalculatedMember name="Exclude Appraiser Role 2 Average Score" dimension="Measures" formula="IIF(([Measures].[Appraiser Role 2 Count],[Appraisee].[Appraisee]) < 3,NULL,IIF([Measures].[Score_1] + [Measures].[Score_2] + [Measures].[Score_3] + [Measures].[Score_4] + [Measures].[Score_5] = 0,NULL,[Measures].[Total Question Score] / ([Measures].[Score_1] + [Measures].[Score_2] + [Measures].[Score_3] + [Measures].[Score_4] + [Measures].[Score_5])))">
<CalculatedMemberProperty name="FORMAT_STRING" expression="IIF([Measures].[Appraiser Role 2 Average Score] < 3, "|#,###.##|style=red" , "|#,###.##|style=green")"/>
</CalculatedMember>
My question now is the following? Where can I find a complete documentation (or more examples at least) about the formatting options that are available?
For example, I am aware about 'arrow' and 'style' attributes but which is the complete list of values they take? Which paradigm do they follow? Mondrian documentation states that format string follows from Visual Basic formatting but this hint didn't prove helpful at all.
EDIT 2: As expected, colors are HTML. Question remains about arrows and other possible available attributes.
You can read this : http://jira.meteorite.bi/browse/SKU-1112
The difficulty is that this formatting must be done by Saiku (not Mondrian), so it must implement an interpreter of the formatting clauses and this not a simple task.

icCube - How can I modify the information that will be exported in Excel file

This the OutPut of my Excel file :
I want to Change the date to be more comprehensible. Thanks for your Help
This is known issue, will be part of next release.
As a workaround you can use DateToString function in your measure.
DateToString function does not convert currently, will be done in the next release, measures to their values (see issues).
As a workaround you'll have to do this manually :
[Measures].[My Date].value
or
[Measures].[My Date].value->asValue()
The second is needed if you're using a special aggregation method (e.g. min/max/open/close ) and will need Java to be active in icCube (doc)

Using AND and OR together on the IF function

Hi all I have been trying to fin out how to use AND and OR together on the same formula.
I'm trying to resolve the following issue :
The person will get a discount only if they are working on the Cerrovial project or if they are working on the Parinas project but the risk of the job must be Low
I tried to use a formula and excel gave me an error and also fixed my formula but I do not know if this is correct or what the "*" means
=IF(OR(D14="CerroVial",D14="Parinas")*AND(E14="Low"),"8%","")
You were close:
=IF(AND(OR(D14="CerroVial",D14="Parinas"),E14="Low"),"8%","")
All the elements of the AND need to be in the AND(...), just like for the OR, which you had done correctly.

How to implement different data for cucumber scenarios based on environment

I have an issue with executing the cucumber-jvm scenarios in different environments. Data that is incorporated in the feature files for scenarios belongs to one environment. To execute the scenarios in different environemnts, I need to update the data in the features files as per the environment to be executed.
for example, in the following scenario, i have the search criteria included in the feature file. search criteria is valid for lets say QA env.
Scenario: search user with valid criteria
Given user navigated to login page
And clicked search link
When searched by providing search criteria
|fname1 |lname1 |address1|address2|city1|state1|58884|
Then verify the results displayed
it works fine in QA env. But to execute the same scenario in other environments (UAT,stage..), i need to modify search criteria in feature files as per the data in those environments.
I'm thinking about maintaing the data for scenarios in properties file for different environments and read it based on the execution environment.
if data is in properties file, scenario will look like below. Instead of the search criteria, I will give propertyName:
Scenario: search user with valid criteria
Given user navigated to login page
And clicked search link
When searched by providing search criteria
|validSearchCriteria|
Then verify the results displayed
Is there any other way I could maintain the data for scenarios for all environments and use it as per the environment the scenario is getting executed? please let me know.
Thanks
I understand the problem, but I don't quite understand the example, so allow me to provide my own example to illustrate how this can be solved.
Let's assume we test a library management software and that in our development environment our test data have 3 books by Leo Tolstoy.
We can have test case like this:
Scenario: Search by Author
When I search for "Leo Tolstoy" books
Then I should get result "3"
Now let's assume we create our QA test environment and in that environment we have 5 books by Leo Tolstoy. The question is how do we modify our test case so it works in both environments?
One way is to use tags. For example:
#dev_env
Scenario: Search by Author
When I search for "Leo Tolstoy" books
Then I should get result "3"
#qa_env
Scenario: Search by Author
When I search for "Leo Tolstoy" books
Then I should get result "5"
The problem here is that we have lots of code duplication. We can solve that by using Scenario Outline, like this:
Scenario Outline: Search by Author
When I search for "Leo Tolstoy"
Then I should see "<number_of_books>" books
#qa_env
Examples:
| number_of_books |
| 5 |
#dev_env
Examples:
| number_of_books |
| 3 |
Now when you execute the tests, you should use #dev_env tag in dev environment and #qa_env in QA environment.
I'll be glad to hear some other ways to solve this problem.
You can do this in two ways
Push the programming up, so that you pass in the search criteria by the way you run cucumber
Push the programming down, so that your step definition uses the environment to decide where to get the valid search criteria from
Both of these involve writing a more abstract feature that does not specify the details of the search criteria. So you should end up with a feature that is like
Scenario: Search with valid criteria
When I search with valid criteria
Then I get valid results
I would implement this using the second method and write the step definitions as follows:
When "I search with valid criteria" do
search_with_valid_criteria
end
module SearchStepHelper
def search_with_valid_criteria
criteria = retrieve_criteria
search_with criteria
end
def retrieve_criteria
# get the environment you are working in
# use the environment to retrieve the search criteria
# return the criteria
end
end
World SearchStepHelper
Notice that all I have done is change the place where you do the work, from the feature, to a helper method in a module.
This means that as you are doing your programming in a proper programming language (rather than in the features) you can do whatever you want to get the correct criteria.
This may have been answered elsewhere but the team I work with currently tends to prefer pushing environmental-specific pre-conditions down into the code behind the step definitions.
One way to do this is by setting the environment name as an environment variable in the process running the test runner class. An example could be $ENV set to 'Dev'. Then #Before each scenario is tested it is possible verify the environment in which the scenario is being executed and load any environment-specific data needed by the scenario:
#Before
public void before(Scenario scenario) throws Throwable {
String scenarioName = scenario.getName();
env = System.getenv("ENV");
if (env == null) {
env = "Dev";
}
envHelper.loadEnvironmentSpecificVariables();
}
Here we set a 'default' value of 'Dev' in case the test runner is run without the environment variable being set. The envHelper points to a test utility class with the method loadEnvironmentSpecificVariables() that could load data from a JSON, csv, XML file with data specific to the environment being tested against.
An advantage of this approach is that it can help to de-clutter Feature files from potentially distracting environmental meta-data which can impact the readability of the feature outside of the development and testing domains.

Resources