Good Day, Smart peeps
I am struggling with this statement to display a record from a collection called 'colRecord' into a text input called 'TextPMeterMake' through it's 'Default' property. The starting default value for the textbox is from a dropdown selection referencing the PM_Make record. I am trying to implement an Edit function from a gallery on another screen which repopulates all fields in the Setup screen with the stored values from 'colRecord' so they can be reviewed and/or changed.
Here is the code I am trying, based on an If statement dependent on 'varEditMode' = "Edit".
If(varEditMode = "Edit", colRecord.PM_Make, ComboCalGear.Selected.PM_Make)
I've tried SearchText as well, I'm just not sure how to reference a collection record inside of an If statement on this Default property.. Nothing I try seems to work 😖 Still haven't fully grasped the syntax and coding methodology used by PowerApps...
Thank you in advance!
Solved! Go to Solution.
Hi @LeeB_CDN ,
I actually almost posted this last time - if you have one record in the collection
If(
varEditMode = "Edit",
First(colRecord).PM_Make,
ComboCalGear.Selected.PM_Make
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi @LeeB_CDN ,
The first thing I see here is the reference to colRecord.PM_Make, which is a Table (with one field). You need to specify which record (containing the value you want) is to be used. What criteria do you need to find this record?
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi @WarrenBelz
colRecord has one record, with multiple columns … (it is loaded from a gallery .ThisItem function. So PM_Make is a column that only has one value… so I’m not sure how to specify a search parameter for it?
Hi @LeeB_CDN ,
I actually almost posted this last time - if you have one record in the collection
If(
varEditMode = "Edit",
First(colRecord).PM_Make,
ComboCalGear.Selected.PM_Make
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Thanks @WarrenBelz
Yes, I’ve been messing around with First() but didn’t seem to get a result, I will try again here.
Here is a visual walkthrough of what I am trying to achieve:
I have the initial steps working for the first two dropdowns (Customer and Technician), but am having issues with the Text Input fields not updating or reverting to the Selected Calibration Kit, after entering custom values and saving... I am wondering if I need to separate a 'New' Report and create duplicated screens for Editing which only reference the colRecord collection to simplify the relationships (instead of trying to use one screen and variables etc. to update Default properties every time something is changed...) That would be double the amount of work to program, so kind of stuck... As I also have conditional formatting on the Text Inputs verifying the Cal Date with the current date to ensure it is within acceptable intervals (green or red).
Just trying to explain the workflow and hoping you had some insight on an efficient path forward?
Thank you for your help!!
Hi @LeeB_CDN ,
Can we deal with the question you initially posted first please (a simple question on code) - does the First() syntax I posted give you a valid result for what you are looking for?
Hi @WarrenBelz ,
Yes, apologies, I was getting ahead of myself... I was able to change the Text input field using the syntax you provided, however it did not produce the overall result I was looking for in terms of functionality... Hence my visual diagram... Thank you again for looking and your patient assistance!
Hi @LeeB_CDN ,
My initial thought (without trying to fully visualising a model with the limited information you have provided) seems to indicate it may be a little flawed in design. You have not said what happens on the Next button or what Mode the Form is in (I assume New), however if you are trying to use the Form to view or edit records from the collection, this cannot be done - a Form's items need to refer to a data source.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Thank you for taking the time to respond @WarrenBelz,
I am not using forms with this design, it is 100% Canvas controls, as such the Application always starts with a "new" report if a current 'colUnsavedRecords' collection is empty, if it is not empty than the Report screen loads where the user selects (or deletes) a report that is in progress.
I will be adding a 'New Report' button on that screen as well. When the user pressed next, they go to another data entry screen that is a combination of drop downs, and Text Input boxes again, where all of the same functionality from the Report Setup screen will also be implemented...
I can't use Forms in this design as it has to be fully offline capable, so I am saving all collection data locally and loading it as I go... I hope that makes some sense? My current issue right now is getting the data loading properly between the Text Input Boxes and the Calibration Kit dropdown. Every time I save the changes (including when I manually enter data into the Combobox and/or text inputs) and go to edit the record again, the values all disappear from the Text Input boxes I have this code on the Combobox DefaultSelectedItems property but it throws an error:
If(varEditMode = "Edit", colRecord.KIT_ID, ComboCalGear.Selected.PM_Make)
and this code on the first Text Input box which displays the make of the KIT_ID that the user selected:
If(varEditMode = "Edit", First(colRecord).PM_Make, ComboCalGear.Selected.PM_Make)
I can get it to update back and forth correctly if I am only selecting items from the drop down list, but if I manually enter a value it will not recall the value once I save... I know there is something difficult with the text input boxes, should I try using labels for the input/output of these calibration kit details?
Thanks again for any assistance... I feel like I am so close to making this work, just can't seem to nail it.
User | Count |
---|---|
255 | |
112 | |
92 | |
48 | |
38 |