Hi PowerApps Community,
I have a bit of a strange scenario where there is no Business Unit field from my dynamics datasource. However, the users would like to be able to filter a gallery based on 'Business Unit'. They have said that I can extract the 10th letter from the Project ID and this will show which Business Unit the record belongs to:
| Letter | Business Unit |
| A | GMP Manufacturing |
| C | Analytical |
| D | POP |
| E | Labelled Compounds |
Since I need to have an actual field to be able to target in my filter for my gallery, I have used the AddColumns function to create a field called "BULetter".
However, this is where I have become stuck. I am trying to add the expression that will assign the correct letter. I am using the find() function which either returns the index position of the letter or blank.
Here is my code in OnStart property:
ClearCollect(
colMilestoneTable,
AddColumns(
ALMACProjOnAccTrans,
"PMID",
LookUp(
Projects,
ProjectID = 'Project ID'
).WorkerResponsiblePersonnelNumber,
"PT",
LookUp(
Projects,
ProjectID = 'Project ID'
).SortingId1,
"MonthYear",
Text('Project date', "mmm-yyyy"),
"BULetter",
If(!IsBlank(Find("C",colMilestoneTable.'Project ID',10)),"Analytical"),
If(!IsBlank(Find("A",colMilestoneTable.'Project ID',10)),"GMP Manufacturing"),
If(!IsBlank(Find("D",colMilestoneTable.'Project ID',10)),"POP"),
If(!IsBlank(Find("E",colMilestoneTable.'Project ID',10)),"Labelled Compounds")
)
);
As you can see I am trying to check if the Project ID returns something or is blank and then set the value to the business unit.
However, I am getting an error of "Text Literal expected".
I know this is a strange scenario but could someone point me in the right direction for this?
Thanks,
Aaron