MS PowerApps,如果在powerapps中切换之后,那么它是独立执行的(切换之后,不在里面)
MS PowerApps, If after Switch in powerapps, so it's executed independently (after switch, not inside)
我遇到 PowerApps 功能问题,我自己无法解决。
您可以在下面找到有效的代码(尽管我认为它没有得到很好的优化)。在主题中,if 条件在 switch 内部执行,作为它的参数之一,而不是在 switch 之后执行。最终结果应该是:用户按下按钮,在 table 上应用过滤器,然后如果条件开始播放,就完成了它的工作。
主要部分是 if 条件,当用户在下拉菜单中选择条件时,条件按名称或等级排序 table。在那个条件下,有支持搜索引擎和排序ascending/descending按钮的功能。
之后我想添加对过滤器按钮的支持,按钮本身工作正常,但 if 条件仅在按下最后一个按钮时执行(所以当我按下它相关的按钮时,它将类别设置为“1”并且导航到下一个屏幕,但 searching/sorting 不起作用)。
我尝试用更多的括号分隔条件,在 switch 的末尾添加“;;”,但它没有解决问题(另外破坏了应用程序)。
Switch(
category;
1;
Filter(
Table1_2;
'4. Area of training' = "IT-related"
);
//here is a bunch of filters for categories from 2 to 4
5; //no filter as it should display table without any filter
If( //the problematic if, that is executed only when category is "5"
dropdown_sort.Selected.Value = "Name of the training"; //check what the value of dropdown is, and the execute positive or negative case
SortByColumns(
Search(
Table1_2;
search_engine.Text; //takes text input and searches inside column below
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"
);
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"; //sorting on this column
If( //to change ascendin/descending on button press
sort;
Ascending;
Descending
)
);
//here is second part of if, that is basically identical to above (it sorts different column), and executes case when selected value of dropdown is different that "Name..."
)
)
我想不管开关如何执行。此外,如果有更好的方法,请写下您的建议。谢谢。
这可能不是最终答案,但根据我阅读的内容,我会尝试以下内容。
if( category=1;
Filter(
Table1_2;
'4. Area of training' = "IT-related"
);;If( //the problematic if, that is executed only when category is "5"
dropdown_sort.Selected.Value = "Name of the training"; //check what the value of dropdown is, and the execute positive or negative case
SortByColumns(
Search(
Table1_2;
search_engine.Text; //takes text input and searches inside column below
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"
);
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"; //sorting on this column
If( //to change ascendin/descending on button press
sort;
Ascending;
Descending
)
);
//here is second part of if, that is basically identical to above (it sorts different column), and executes case when selected value of dropdown is different that "Name..."
)
category=2;
Filter(
Table1_2;
'4. Area of training' = "IT-related"
);;If( //the problematic if, that is executed only when category is "5"
dropdown_sort.Selected.Value = "Name of the training"; //check what the value of dropdown is, and the execute positive or negative case
SortByColumns(
Search(
Table1_2;
search_engine.Text; //takes text input and searches inside column below
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"
);
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"; //sorting on this column
If( //to change ascendin/descending on button press
sort;
Ascending;
Descending
)
);
//here is second part of if, that is basically identical to above (it sorts different column), and executes case when selected value of dropdown is different that "Name..."
)
//here is a bunch of filters for categories from 2 to 4
category=5;
)
与此同时,我设法自己解决了这个问题,与您的建议类似。错误值和其他类别的代码相同。无论如何,谢谢你的帮助。
Switch(
category;
1;
If(
dropdown_sort.Selected.Value = "Name of the training";
SortByColumns(
Search(
Filter(
Table1_2;
'4. Area of training' = "IT-related"
);
search_engine.Text;
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"
);
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training";
If(
sort;
Ascending;
Descending
)
);
我遇到 PowerApps 功能问题,我自己无法解决。 您可以在下面找到有效的代码(尽管我认为它没有得到很好的优化)。在主题中,if 条件在 switch 内部执行,作为它的参数之一,而不是在 switch 之后执行。最终结果应该是:用户按下按钮,在 table 上应用过滤器,然后如果条件开始播放,就完成了它的工作。
主要部分是 if 条件,当用户在下拉菜单中选择条件时,条件按名称或等级排序 table。在那个条件下,有支持搜索引擎和排序ascending/descending按钮的功能。 之后我想添加对过滤器按钮的支持,按钮本身工作正常,但 if 条件仅在按下最后一个按钮时执行(所以当我按下它相关的按钮时,它将类别设置为“1”并且导航到下一个屏幕,但 searching/sorting 不起作用)。 我尝试用更多的括号分隔条件,在 switch 的末尾添加“;;”,但它没有解决问题(另外破坏了应用程序)。
Switch(
category;
1;
Filter(
Table1_2;
'4. Area of training' = "IT-related"
);
//here is a bunch of filters for categories from 2 to 4
5; //no filter as it should display table without any filter
If( //the problematic if, that is executed only when category is "5"
dropdown_sort.Selected.Value = "Name of the training"; //check what the value of dropdown is, and the execute positive or negative case
SortByColumns(
Search(
Table1_2;
search_engine.Text; //takes text input and searches inside column below
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"
);
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"; //sorting on this column
If( //to change ascendin/descending on button press
sort;
Ascending;
Descending
)
);
//here is second part of if, that is basically identical to above (it sorts different column), and executes case when selected value of dropdown is different that "Name..."
)
)
我想不管开关如何执行。此外,如果有更好的方法,请写下您的建议。谢谢。
这可能不是最终答案,但根据我阅读的内容,我会尝试以下内容。
if( category=1;
Filter(
Table1_2;
'4. Area of training' = "IT-related"
);;If( //the problematic if, that is executed only when category is "5"
dropdown_sort.Selected.Value = "Name of the training"; //check what the value of dropdown is, and the execute positive or negative case
SortByColumns(
Search(
Table1_2;
search_engine.Text; //takes text input and searches inside column below
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"
);
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"; //sorting on this column
If( //to change ascendin/descending on button press
sort;
Ascending;
Descending
)
);
//here is second part of if, that is basically identical to above (it sorts different column), and executes case when selected value of dropdown is different that "Name..."
)
category=2;
Filter(
Table1_2;
'4. Area of training' = "IT-related"
);;If( //the problematic if, that is executed only when category is "5"
dropdown_sort.Selected.Value = "Name of the training"; //check what the value of dropdown is, and the execute positive or negative case
SortByColumns(
Search(
Table1_2;
search_engine.Text; //takes text input and searches inside column below
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"
);
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"; //sorting on this column
If( //to change ascendin/descending on button press
sort;
Ascending;
Descending
)
);
//here is second part of if, that is basically identical to above (it sorts different column), and executes case when selected value of dropdown is different that "Name..."
)
//here is a bunch of filters for categories from 2 to 4
category=5;
)
与此同时,我设法自己解决了这个问题,与您的建议类似。错误值和其他类别的代码相同。无论如何,谢谢你的帮助。
Switch(
category;
1;
If(
dropdown_sort.Selected.Value = "Name of the training";
SortByColumns(
Search(
Filter(
Table1_2;
'4. Area of training' = "IT-related"
);
search_engine.Text;
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training"
);
"3_x002e__x0020_Name_x0020_of_x0020_the_x0020_training";
If(
sort;
Ascending;
Descending
)
);