web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter Gallery based o...
Power Apps
Answered

Filter Gallery based on an Add Columns new column

(0) ShareShare
ReportReport
Posted on by 137

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:

LetterBusiness Unit
AGMP Manufacturing
CAnalytical
DPOP
ELabelled 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

Categories:
  • Verified answer
    AR-29081311-0 Profile Picture
    137 on at

    Hi all, 

    For anyone looking for the solution I was able to use the Mid() function better for this scenario and all seems to be working! Code: 

    "BULetter",
     If(
     Mid(
     ProjID,
     10,
     1
     ) = "C",
     "Analytical",
     Mid(
     ProjID,
     10,
     1
     ) = "A",
     "GMP Manufacturing",
     Mid(
     ProjID,
     10,
     1
     ) = "D",
     "POP",
     Mid(
     ProjID,
     10,
     1
     ) = "E",
     "Labelled Compounds"
     )
     )
  • v-LilyW-msft Profile Picture
    Microsoft Employee on at

    Hi @ARAlmac 

    Thanks for your posting here and sharing the solution in the forum as it would be helpful to anyone who encounters similar issues.

    Best regards,

    Community Support Team _ Lily

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard