I have this Expense Report (Sharepoint List) where in the power apps form we use Average Exchange rates of last year to convert the amount to Euro.
If the 2023 Average rates is not yet available, I have this formula in the datacard where it will chose the 2022 Average rate.
Details of the Exchange rate sharepoint list:
Title - single text (This is the year of the Average rate)
Year to use rate- single text (if the Average rate is from 2022, 2023 will be using it)
Currency Code - Single text
Rate - Number
Default of the text input (Conversion):
IfError(If(IsBlank(Price.Text),"",If(IsBlank(LookUp(ExchangeRate, 'Year to Use Rate' = DD_Year.SelectedText.Value,'Year to Use Rate')),LookUp(ExchangeRate, 'Year to Use Rate' = Text(DD_Year.SelectedText.Value - 1 , "####") && CurrencyCode = PriceCurrency.Text,'Rate'),LookUp(ExchangeRate, 'Year to Use Rate' = DD_Year.SelectedText.Value && CurrencyCode = PriceCurrency.Text,'Rate'))),"")
New Form Datacards textinput names:
ExpenseName
PriceCurrency.
Price
Conversion
TotalAmount
Outside the form dropdown:
DD_Year
Once the details from the form got saved. There's a Gallery where they could edit it.
I want a button which will update new Conversion rate.
I have 2 galleries btw, incase it will affect your solutions.
Galleries:
GroupOfRecords
Items property:
GroupBy(Filter(ExpenseReport, Organizer.Email = User().Email,
Record_DDYear.SelectedText.Value = Blank() Or Title = Record_DDYear.SelectedText.Value ,
Record_DDRegion.SelectedText.Value = Blank() Or Region = Record_DDRegion.SelectedText.Value)
,"VersionNumber","GroupVersion")
Details Gallery - This will show all the details with the same Versions . This is where I will allow the users to edit what they saved. I'll be adding button to patch changes as well.
Items Property:
SortByColumns(Filter(ExpenseReport,VersionNumber=GroupOfRecords.Selected.VersionNumber),"ExpenseGroup",SortOrder.Ascending)
The 'Update Conversion' button is outside the galleries, so its a one time thing.
At first, I've thought of adding a variable in the button .
Set(Record_ToUpdateConvert,LookUp(ExchangeRate, 'Year to Use Rate' = Record_DDYear.SelectedText.Value && CurrencyCode = RecordCurrency.Selected.Value).'Currency unit to Euro = 1')
Fyi:
RecordCurrency.Selected.Value is a dropdown inside the Details Gallery where the default selected value is {Value :ThisItem.Currency}, while the Items is Distinct(ExchangeRate,CurrencyCode)
Record_DDYear.SelectedText.Value is outside the galleries dropdown to filter GroupOfRecords gallery
Issue:
Details Gallery:
The text input became blank.
If I click the button, the text input is still blank.
If I selected a Group in the GroupOfVersionGallery, the text input is still blank. So, if the user did not yet click the Update Conversion button, I want it to still show what was saved.
I'm not sure if I explain my issues well. English is not my first language and I'm not that good with it.