Power Apps Exchange

Please login or click SIGN UP FOR FREE to create your PowerAppsUG account to join this user group.
 View Only
  • 1.  Collection issue and Rounding Average of Ratings Control

    Gold Contributor
    Posted Jan 09, 2023 03:19 PM
    A few issues I'm running into with Training curriculum/review Power App.

    Parent List: Training Curriculum
    Child List: Training Ratings
    Training Ratings has a ParentID column that looks up to ID column in Training Curriculum
    User can lookup course(s) then go to the Reviews screen to submit a review, which patches to Training Ratings list.

    Home Screen is where course lookup happens
    galHome displays the records using this Items property that includes Search box, dropdown and combo box and sorts by 'field_2':
    SortByColumns(Filter(
    'Training Curriculum',
    txtSearchGalHome.Text in 'Training name',
    ddnTrainingType.Selected.Result = TrainingType.Value,
    cmbExpLevel.Selected in ExperienceLevel
    ),"field_2")

    In galHome, I have OnSelect property that sets varRecord to:
    Set(
    varRecord,
    ThisItem
    )

    Issue 1: I'm certain varRecord is being set correctly here, but sometimes the colReviews table doesn't get set when the "Learn More" button is clicked. See error on scrLearnMore "the function Average cannot be used with an empty table"

    In galHome Learn More button OnSelect property creates collection 'colReviews' to capture all the ratings and reviews for that course:
    Select(Parent);
    ClearCollect(
    colReviews,
    Filter(
    TrainingRatings,
    ParentID = varRecord.ID
    )
    );
    Navigate(
    scrLearnMore,
    ScreenTransition.Fade,
    {itemToEdit: varRecord}
    )

    Issue 2: I'm using the Ratings control to get each of the Overall Rating, Methodology, Content, and Trainer average of all the reviews for that training course. This control is lacking functionality IMO because I have an Overall Rating of 2.9, but the control shows 2 Stars. I've tried using Round, then Average as seen in Methodology example, but still same output. Is there a way to add in "If" in the Ratings Default property that rounds down if the value is #.0-#.4 and rounds up if the value is #.5-#.9?

    ------------------------------
    Beth Beck
    O365 Business Analyst
    Fort Myers FL
    ------------------------------


  • 2.  RE: Collection issue and Rounding Average of Ratings Control

    Posted Jan 10, 2023 12:44 AM
    Hi Beth

    Happy new year, hope you are well.

    I have a suspicion that where you are capturing varRecord might be the problem.

    It appears to me that varRecord is only set when the user clicks onto the rating or anywhere within that rectangular space I have highlighted.



    The Learn More button appears to reference varRecord but if the user never clicked onto the rating or anywhere in that rectangle to set the varRecord, wouldn't that mean that the ID is blank when clicking Learn More?

    If so, you may want to add Set(varRecord, ThisItem) in your OnSelect of Learn More after Select(Parent) and before ClearCollect.

    I hope something in the above helps to find a solution!

    Good luck and best wishes
    Damien

    ------------------------------
    Damien Rosario
    Knowledge and Training Coordinator
    ------------------------------



  • 3.  RE: Collection issue and Rounding Average of Ratings Control

    Gold Contributor
    Posted Jan 10, 2023 10:28 AM
    Happy New Year Damien. Yes, you were correct in that the set(varRecord) was in the wrong spot. I had an inkling that was the issue. I've made your recommended change and that has works. Thank you SO much!

    ------------------------------
    Beth Beck
    O365 Business Analyst
    Fort Myers FL
    ------------------------------



  • 4.  RE: Collection issue and Rounding Average of Ratings Control

    Posted Jan 10, 2023 05:36 PM
    Hi Beth

    I'm glad to hear that the ID issue is resolved!

    Did you have any luck with issue 2? If not, will see if we can nut it out.

    If you find that this topic is resolved, please mark it as resolved so it's off the radar for anyone watching.

    Enjoy your Wednesday!

    Cheers
    Damien

    ------------------------------
    Damien Rosario
    Knowledge and Training Coordinator
    ------------------------------



  • 5.  RE: Collection issue and Rounding Average of Ratings Control

    Gold Contributor
    Posted Jan 11, 2023 09:23 PM
    Hi Damien,
    Happy Wednesday! I found this article for Issue #2 - Star rating in Power Apps canvas app with decimals – terhoantila.com, but I didn't have time today to try it out. I'll try to get to it before the end of the week. For now,, I'd like to leave this open.

    Thanks,
    Beth​

    ------------------------------
    Beth Beck
    O365 Business Analyst
    Fort Myers FL
    ------------------------------



  • 6.  RE: Collection issue and Rounding Average of Ratings Control

    Posted Jan 11, 2023 10:06 PM
    Hi Beth

    Hopefully your article works out. Please do stay in touch and perhaps we can all put our heads together to resolve this if needed.

    Enjoy your day ahead!

    Cheers
    Damien

    ------------------------------
    Damien Rosario
    Knowledge and Training Coordinator
    ------------------------------



  • 7.  RE: Collection issue and Rounding Average of Ratings Control
    Best Answer

    Gold Contributor
    Posted Jan 15, 2023 10:28 AM
    I got this to work (I think). I created a Label Control named "lblOverallRating" with this Text property:
    Round(
    Average(
    colReviews,
    zzRating
    ),
    0
    )

    Then I entered lblOverallRating in the Default property of my Rating Control. I will mark this as solved.

    ------------------------------
    Beth Beck
    O365 Business Analyst
    Fort Myers FL
    ------------------------------