cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Corry
Advocate V
Advocate V

Display Shelter Name - Model-driven app Requirement

Hi everyone,

 

I am stumped on figuring out how to display the name of shelters in my 'Animal' table view.
The first requirement states "View a list of animals displaying name, type, shelter status and shelter name".

 

Shelter name doesn't exist in the 'Animal table final' Excel data but does exist in the 'Shelter table final' Excel data.
I am trying to display the 'Shelter Name' in a new column in the 'Animal' table by checking if the value in my 'Current Locations' column in my 'Animal' table matches the 'ShelterID' from the 'Animal Shelter' table. If it does match 'ShelterID', display the 'ShelterName' from the 'Animal Shelter' table.

I tried this as a PowerFx formular column called 'Shelter Name', but I couldn't get the attributes I need.

I also added the 'ShelterName' column as a related column in the 'Active Animals' table view for the 'Animal' table, but no results appear. See Animal_Table_View_Related_ShelterName_Column.png

 

My 'Current Locations' column is a PowerFx formula column with the following code:

Switch('Shelter Status',
'Shelter Status (Animals)'.'In Shelter','Initial Shelter'.ShelterID,
'Shelter Status (Animals)'.'Ready for Foster','Initial Shelter'.ShelterID,
'Shelter Status (Animals)'.'In Foster Home','Foster Claimer'.FosterID,
'Shelter Status (Animals)'.'Claimed for Adoption','Foster Claimer'.FosterID,
'Shelter Status (Animals)'.'Ready for Adoption','Foster Claimer'.FosterID,
'Shelter Status (Animals)'.Adopted,Blank
())

Although I have followed the learning material, this one has gotten me stuck. I know there is a way, I just can't see it.

I would really appreciate guidance on this so that I can move forward with the other requirements. 

1 ACCEPTED SOLUTION

Accepted Solutions
StineN
Advocate II
Advocate II

Hello! 

I solved this by adding a new column in the Animals table called ShelterName, where I used the lookup column InitialShelter to get the name of the shelter. This will get the name of the initial shelter that the animal belongs to, and doesn't change even if it's moved to a foster family or adopted. In my opinion that should fulfill the requirements of showing animals by shelter name. 

 

- In the Shelter table, there is a coulmn called ShelterName

- In the Animals table, InitialShelter is a lookup on the Shelters table 

- In the Power Fx formula on ShelterName in the Animals table, I access the name column from the related table with this formula: InitialShelter.ShelterName

 

I then added this column to the model-driven app. 

StineN_0-1715682079941.png

StineN_1-1715682114351.png

 

 

View solution in original post

27 REPLIES 27

Hello Corry

I am stuck here too, not sure how to go about it

 

Corry
Advocate V
Advocate V

So, after reading many articles to try to understand how Dataverse Column Formulas work, I am still just as confused. Work with formula columns 

So naturally, I had a lengthy and arduous conversation with ChatGPT, constantly telling it that the functions it was giving me were not supported in Dataverse Column Formulas.

But I persevered and it finally spat out something that is at least a temporary fix for now. (Hard Coded values!)

Here is my approach to display the Shelter Names in my Main Information Form for the Animal Table.

 

  1. Ensure there is a N:1 Relationship between the Animal table and the Shelter table.
    1. My relationship is Many Animals to 1 Shelter. (Relationship Name: cr0f4_animals_ShelterID_cr0f4_animalshelt)
  2. Create a new formula column in the Animal Table called 'Shelter Name'.
  3. Add this formula to hard code the values.
    1. If(
      IsBlank('Current Location'),
      "", // Return empty string if Current Location is blank
      Switch(
      'Current Location',
      "S-01","Hooves Haven Rescue Clinic",
      "S-02","Companion Critter Retreat",
      "S-03","Pawsitive Steps Shelter",
      "S-04","Happy Tails Haven",
      "S-05","Loving Paws Shelter",
      ""
      )
      )
  4. Save, Publish, and Test.
  5. Add newly created Shelter Name column to view.
  6. Save, Publish, and Test.

Unfortunately, this is not the ideal solution as it would require manually updating the formula as more Shelters are added, but I have put too many hours into trying to resolve this a proper way.

 

Side note, I did try a different formula that Dataverse accepted but it didn't produce the desired result.

 

If(
IsBlank('Current Location'),
"", // Return empty string if Current Location is blank
Switch(
'Current Location',
'Current Location', ShelterID.ShelterName,
""
)
)

 

Corry_0-1715396472172.png

 

Corry_1-1715396549402.png

 

heey,

In case the current location is empty or it FH- , what is the shelter name will be

Hi @Esraa_k,

 

In the formula I have used, if Current Location is empty this part of the formula returns an empty string i.e., nothing.

 

IsBlank('Current Location'),
"", // Return empty string if Current Location is blank

 

For FH-, I’m not showing these values with my formula as these are not shelters, they are foster homes.

 

As my column is called Shelter Name, I felt it would be confusing to show non-shelter location names.

 

I hope this explains my approach.

Esraa_k
Frequent Visitor

Okay, in case the current location was empty of FH the shelter name will not be displayed, it's means if the shelter staff tries to filter with the shelter name some animals will not be displayed because their current location was empty of FH.

So why you didn't use Intiail shelter column?

StineN
Advocate II
Advocate II

Hello! 

I solved this by adding a new column in the Animals table called ShelterName, where I used the lookup column InitialShelter to get the name of the shelter. This will get the name of the initial shelter that the animal belongs to, and doesn't change even if it's moved to a foster family or adopted. In my opinion that should fulfill the requirements of showing animals by shelter name. 

 

- In the Shelter table, there is a coulmn called ShelterName

- In the Animals table, InitialShelter is a lookup on the Shelters table 

- In the Power Fx formula on ShelterName in the Animals table, I access the name column from the related table with this formula: InitialShelter.ShelterName

 

I then added this column to the model-driven app. 

StineN_0-1715682079941.png

StineN_1-1715682114351.png

 

 

I too, read Documentation and watched Videos, and tried different ... Thank you for your solution. At least if it works, it is better than banging my head and never finishing this.

In my mind, initial Shelter wasn't an accurate representation of where the animal currently is in respect to shelters. But since looking at the data, I have noticed that if an animal is in a shelter, the initial shelter and the current location will be the same.

I have taken on the approach that @StineN has posted here in this thread by using the formula InitialShelter.ShelterName.

Thank you @Esraa_k for being inquisitive.

Thank you @StineN

 

I think I got jumbled up in my way of thinking that made this more complicated than it needed to be. I appreciate your contribution and love the simplicity in your approach.

I have taken this on board and using it in my solution.

Helpful resources

Announcements

Important Update | Power Up Community READ ONLY July 22 – July 28

Dear Community Members, As you may have read, the Power Platform communities are transitioning to a new platform and to access will be set to READ-ONLY mode during the transition. Key DatesTo ensure current learners have adequate support in the final week of the cohort, the Power Up Program Community will transition to READ-ONLY mode starting July 22nd, the platform will transition to READ-ONLY mode until July 28th. Power Apps, Power Automate, and Power Pages communities will be read-only July 16-22, 2024.During this period, members will not be able to start new threads or Kudo, Comment, or Reply to any posts, but will be able to search and review past threads or solutions. On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities. Learners will be able to sign in to the new Power Up Program community experience, starting July 29th. If you registered for community using your learnwithpowerup account, you will not receive an email, but should be able to sign in successfully if you are signed in to My hub.  If you need help with your community account, please submit a request at aka.ms/PPCommSupport We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead! 

Learn what to expect in the Power Up Program

Since its inception in 2022, the Power Up Program has evolved based on feedback from learners and Microsoft Partners and customers. Today's Power Up learners can expect to learn the fundamentals of Microsoft Power Platform in the accelerated seven-week, video-based Power Up Maker course.   Hear from Principal Program Manager, Dimpi Gandhi to discover the latest enhancements and meet the Microsoft MVPs, Rory Neary and Charlie Phipps, who partnered with the Microsoft Power Up Program to create the Power Up Maker course to guide learners to use the Microsoft Power Platform to develop custom applications, build dazzling report dashboards, or create efficiencies through automation.  

Welcome to the Power Up Program Community

The Power Up Program is a free upskilling program where nontechnical people can learn the fundamentals of Microsoft Power Platform. The Power Up Maker course is a seven-week self-paced virtual learning plan that include video-based objectives featuring Power Apps, Power BI and Power Automate.  As a member of the Power Up Community, you can grow your skills and build connections. You can post questions to get help with the curriculum and hands-on exercises from experts and peers in the product boards.  Check out the Community Information & Feedback board to find help or provide feedback with the community experience, and please take time to post in the Social board to tell us more about yourself. If you're new to the Power Up Program and looking for information to register. You can sign up at PowerUp.Microsoft.com.

Users online (968)