cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Englishweb
Post Patron
Post Patron

Global Variables = No Value

Hello @ eka24  @

I followed your instructions to set a global variable on a calculated field:

Set(MyCalFigure,1Sum(GalleryHours.AllItems, HOURS)) in a button on screen 1

l added a label and put the Variable on the Text property: MyCalFigure1.

I did the same for 2 other screens which are records from the Main gallery MyCalFigure2 and MyCalFigure3 but nothing is showing in the global variables collection. Each variable shows "No Value" in the variables collection info.

I would like to add the total of these 3 variables together on the main gallery screen MyCalFigure1+MyCalFigure2+MyCalFigure3 but this doesn't work.

It may be worth noting that the Hours used in the calculation are in 'GalleryHours' not the Main Gallery - does this matter?

What am I doing wrong???

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User III
Super User III

"It may be worth noting that the Hours used in the calculation are in 'GalleryHours' not the Main Gallery - does this matter?"

This will not work. Kindly show the items for the two other galleries. That is do separate variables for each then you can sum.

 

If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution

View solution in original post

10 REPLIES 10
eka24
Super User III
Super User III

"It may be worth noting that the Hours used in the calculation are in 'GalleryHours' not the Main Gallery - does this matter?"

This will not work. Kindly show the items for the two other galleries. That is do separate variables for each then you can sum.

 

If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution

View solution in original post

Hello @ eka24
Thanks for your reply. I don’t quite understand how to apply this to my case: the hours are collected as new rows in a table whereas the total hours is patched to a single record in another table. I tried to solve this by creating 3 variables but it doesn’t work. Sorry if I’m not understanding something obvious!

Please show the formula or the items used for the other galleries. Are they 3 galleries? Show the formula

Hello @eka24

The main gallery item is: 

SortByColumns(Search([@SUMMARYDATATABLE];SearchBox.Text;"TutorSurname";"TutorFirstName";"Cohort";"MATHS";"SYSTEMES";"AERONAUTIQUE";"VEHICULES";"ANGLAIS";"SH";"Student1";"Student2";"Student3");"TutorSurname";If(SortDescending1; Descending; Ascending))

 

the other 3 galleries are records from the main gallery Item: ParentGallery.Selected

 

Here is the save details for each subgallery:

Button Onselect:

ClearCollect(CollectTutorInfoALLS1;{TutorSurname:LabelTutorName.Text;Student1:S1StudentNameConcat.Text;S1Cohort:S1CohortConcat.Text;S1SubjectDetail:S1detailsInput.Text;S1Hrs:S1HrsInput.Text;S1ProfContact:S1ProfContactDropdown.SelectedText.Value;S1Subject:S1SubjectList.SelectedText.Value;S1Start:DatePickerS1Start.SelectedDate;S1End:DatePickerS1End.SelectedDate;S1CohortInput:S1CohortConcat.Text;
S1Email:S1EmailConcat.Text;S1Progress:Status1.Text;TotalHrsPrev:TOTALHoursALL.Text});;ClearCollect(CollectComboS1;{NOM:S1ComboConcat.SelectedItems.NOM});;

Patch(StudentsList;Defaults(StudentsList);{Title:S1EmailConcat.Text;CurrentStudents:S1StudentNameConcat.Text});;

Patch(SUMMARYDATATABLE;ThisItem;{Student1:S1StudentNameConcat.Text;S1Cohort:S1CohortConcat.Text;S1SubjectDetail:S1detailsInput.Text;S1Hrs:S1HrsInput.Text;S1ProfContact:S1ProfContactDropdown.SelectedText.Value;S1Subject:S1SubjectList.SelectedText.Value;S1Start:DatePickerS1Start.SelectedDate;S1End:DatePickerS1End.SelectedDate;S1Email:S1EmailConcat.Text;S1Progress:Status1.Text;S1StartText:S1DateTextStart.Text;S1EndText:S1DateTextEnd.Text;TotalHrsPrev:TOTALHoursALL.Text});;

Set(MyCalFigure1;Sum(GalleryCurrentHrs1.AllItems; Hours));;
ClearCollect(MyCollHrsIn;{TutorSurname:LabelTutorName.Text;STUDENTS:S1StudentNameConcat.Text;HOURS:S1HrsInput.Text;PROF:S1ProfContactDropdown.SelectedText.Value;PROGRESS:Status1.Text;TotalHrsComp:LabelSumHrs1.Text});;

Collect(CURRENTHRS; MyCollHrsIn);;

Patch(SUMMARYDATATABLE;ThisItem;{TotalHrsComp:LabelSumHrs1.Text});;

UpdateContext({LetsEdit: false })
;;Set(ShowSavedValue; true)

 

Hope this helps!

 

v-siky-msft
Community Support
Community Support

Hi @Englishweb ,

 

How did you define another two variables? Where do these variables display?

 

Could you please share more details on what do you want to achieve? We need more information so that we can provide further assistance.

Sik

Hello @v-siky-msft 

Thanks for replying.

I have a main browser gallery and 3 screens 1 for each student . (ParentGallery.Selected)Browse gallery screen.jpg

 

 

Screen 1.png

I added a hidden GalleryCurrentHrs1 to the page (the hours table) and I have a variable for each instance of the gallery (one for each screen) Set(MyCalFigure1;Sum(GalleryCurrentHrs1.AllItems; Hours));; in the save button and the variable in a label :MyCalFigure1

HoursTABLE.png

The white box is the total hours: Sum(GalleryCurrentHrs1.AllItems; HOURS) The same total is also patched to the summary table:

SummaryTable.png

In each screen there is a box for the number of hours in progress (green) ThisItem.S1Hrs

When I clear the green boxes I want to maintain a running total of hours for each record in the main browser gallery

Please forgive me if it is easy, but I can't get it to work!

Thanks in advance

Hi @Englishweb ,

 

Sorry, I'm still confused. I cannot understand your case.

Hope you can describe more clearly.

Sik

Hello @v-siky-msft 

Yes of course, please forgive the lack of clarity.

So,

  • I have 2 tables in an excel spreadsheet : Table 1 and Table 2,
  • In my app I have 2 galleries, Gallery 1 (Sourcedata:Table 1) and Gallery 2 (Sourcedata: Table 2)
  • I would like to use this calculation in powerapps Sum(GalleryCurrentHrs1.AllItems; HOURS) to add up all the amounts in a column, in Table 2, filtered by text information from Table 1.
  • I would then like to patch the result of that calculation field to Table 1 and display that calculation in Gallery 1.

I hope this is clearer!

Thanks again for your patience and help

Hello @WarrenBelz 

I'm hoping you can help me, as you are the top Kudo'ed PowerApper!

  • I have 2 tables in an excel spreadsheet : Table 1 and Table 2,
  • In my app I have 2 galleries, Gallery 1 (Sourcedata:Table 1) and Gallery 2 (Sourcedata: Table 2)
  • I would like to use this calculation in powerapps Sum(GalleryCurrentHrs1.AllItems; HOURS) to add up all the amounts in a column, in Table 2, filtered by text information from Table 1.

I would then like to patch the result of that calculation field to Table 1 and display that calculation in Gallery 1.

Is this possible?

Thanks in advance for your help!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,431)