List of variables, edit screen

Is there a way to see all the variables being used in an app or particular screen? I'm looking through the Field Service Agent example system and I'm trying to understand how the edit button works. It appears to be using a variable called IsEdit, but I can't work out where this has been created.

In a separate system I am creating, I made an edit screen by passing the current table row into another screen where I duplicate everything, but make all fields editable instead. This works fine, but then I discovered the Field Service Agent Example which seems to have a much neater solution. But I can't reverse engineer it! It looks like some kind of edit flag is being set which then makes all fields editable within the same screen.

Can someone explain how this works please? I did search the site but can't find any information on how to do this.

You’ve got the basics of the solution. In almost every screen I build, the first thing I add is a an empty content block. In that block, I keep all data cell variables in that block, and then hide that block by setting visibility to false.

For an edit screen like you describe, I’d bet that there’s a similar setup. A data cell called something like $[editing], default value of =false.

Then an edit button with an automation to change the value of $[editing] to =true.

Then, you duplicate every data cell on the page. One version is editable, the other is not.

Finally, you tie the visibility if all the cells back to $[editing], so that they appear and disappear when the value of editing changes.

Thanks, this makes complete sense. However, I'm not sure how to achieve one of the steps.

Then, you duplicate every data cell on the page. One version is editable, the other is not.

Are you saying I should have effectively the same page layout twice in the same screen? As in, I would have the read-only field and the editable field sitting directly on top of each other, but hide and display them at the appropriate times?

the first thing I add is a an empty content block. In that block, I keep all data cell variables in that block, and then hide that block by setting visibility to false.

This sounds like a good idea and I will adopt this method. However, is there a way to find a list of variables another way? The only way I can work it out at the moment is to click on everything in the form and looking at each element to work out what it is.

I went away, had a cup of tea then came back and looked at the solution again and can now see what is happening and answered my own question by re-reading your response.

Are you saying I should have effectively the same page layout twice in the same screen? As in, I would have the read-only field and the editable field sitting directly on top of each other, but hide and display them at the appropriate times?

Yes, this is what you were saying. After looking at the app again, I can see two fields for each piece of data. One editable, one read only. My brain was somehow filtering out the second version of each when I looked at it originally...

Thanks for your help again.

Yup! You got it! Tea always helps. :grin:

Another thing I'll do sometimes is duplicate the "read-only" page, and then make all the fields editable on that page, and have the user switch screens. That can be very helpful if the same record can be viewed in more than one place in your app.

This is what I had in place already and works fine. I was going to continue with that approach, but then I used the example Field Service app and it felt a lot "cleaner" seeing the fields become editable without the whole screen refreshing. It's only a minor thing, but it just felt better from a user perspective.

Also, I feel like it would be easier if the editable flag was accessible and could be toggled by a formula. That way you could have just the fields you want on screen once, then toggle the flag with a button. But then, I don't know where the line is between no/low code platforms and code. Maybe this approach is easier for people with less technical background.

@AndrewB I feel like I'm just one more step away from completing this, but I'm stuck on something that I can't work out.

In the example field service solution, it has:

  1. Edit and Done buttons - The edit button takes the value =TRUE and sets the variable IsEdit. Which you can see here:

image

  1. The data cell IsEdit

  2. The content box which is hidden or displayed, based on the IsEdit flag. The formula for which, can be seen here:

image

All of the above makes sense to me. However, when I try to replicate this in my own app, inside my Edit button, when I try to make the same automation, I have a warning:

It says the reference is invalid, but when I type "=$" it gives me the option to auto complete with "=$[IsEdit]".

I'm not really sure what I need to do to get past this.

Is $[isEdit] set to variable? Needs to be in order for you to change its value

It is. I compared the details of both apps and just couldn't see a difference. So I deleted the buttons and the data cells and started again and it worked first time. I have no idea what the issue was but it now works as I expected it to. Thank you for your help.

This has been super helpful for me to create an edit screen as well! Thanks guys! But quick question

@Adam and @AndrewB were you able to "have the read-only field and the editable field sitting directly on top of each other" ? For now, I haven't been able to overlap any item directly on top of one another!

Update Oops! I tested and realized that the data cells don't actually need to overlap. As long as the read-only field and editable field are adjacent in a content box, the content box will only populate with the visible content. The actual placement of the "data cell" object does not impact where it is displayed within the content box. Lesson learned!

1 Like