Open two modal windows for user input

Hi, I’m bringing this from the OpenWindow() not opening in new tab topic,

I just couldn’t believe I did this, it was almost accidentally.

So here is my use case:

I have a button that:

  1. modifies a row in the current table, and then
  2. adds a row in a log time table , and finally
  3. adds a row in a transactions table.

My issue here, is that I need some fields to be manually filled by the user on both new rows created.

So I took the approach of activating the new rows in a modal window. You can check my formula (simplified):

RunActions(
  ModifyRows(thisRow,  // this is 1.
    // Changes a value in current row
  ),
  Activate(
    AddRow([Log time],  // this is 2.
      // some fiels are automatically filled in
    )
  ),
  Activate( // this is 3
    AddRow(Transacciones, 
      // some fiels are automatically filled in
    )
  )
)

Also I’ve prepared a simplified example: Open two modal views

The trick here is that the formula opens the first row in full view using OpenWindow(), and also activates the second row, which will be open in modal view by default. So the user can fill in whatever is on top, and when closed, the other modal is still open so she/he can modify it too.

Although, it has a limit of two modals. If you try more, they just replace one another.

Ideally, the formula OpenWindow() should have an argument “to choose whether to open the URL in a separate or current tab” (OpenWindow() not opening in new tab - #4 by Asaf_Dafna), or even better, in a new modal window browser. This way it will be possible to open several pop ups for the user (but opening several forms for user’s input can mean a bad UX design).

5 Likes

@Sebastian_Zegada ,

well done indeed, take a bow

i am adding this to my toolbox of UI tricks

impressive

max

2 Likes

Hi, @Sebastian_Zegada .
Wouldn’t OpenRow() action do the trick?.
It’s relatively new and cool function that was added without fanfare.

3 Likes

Oh my, you’re absolutelly right. There’s no need to use OpenWindow() in this case scenario. I’m also saving the url generation and the button that opens the first created row. The modals you can open are unlimited.

Thank you very much @Breno_Nunes!! I’ll update the template for other users.

Also, below is the formula updated. I don’t know yet how to use correctly “viewOrLayout” argument, but as soon as I figure it out I’ll update this topic.

image

RunActions(
  ModifyRows(thisRow, 
    // Some values are changed in the first table
  ),
  OpenRow(
    AddRow([Log time], 
      // some values are filled in in the second table, leaving others for user's input.
    ),[Log time],"Fullscreen"
  ),
  OpenRow(
    AddRow(Transacciones, 
      // // some values are filled in in the third table, leaving others for user's input.
    ),Transacciones,"Fullscreen"
  )
)
1 Like

And I’m also a bit fuzzy on the right way to use OpenRow(). In this example (which works really well) I reference “Certified” which is a canvas field. Despite the error message, it works really well read on).

If users click the canvas icon, the view displayed is the default view and entirely displeasing (the one on the left). Using the viewOrLayout: parameter provides the user with exactly my intended modal display. Bug? Or dumb luck on my part? I’m flexible - I’ll take both. LOL

2 Likes

Ok, I think I figured it out how to use the viewOrLayout argument.

You have to create a view of your table, and use that view as the argument. If you put the table, it will bring the layout selected for tha table. For example:

In Figure 1 I have the “Layout 1” selected as defaul for mi “Transacciones” table. In Figure 2 I have the “Layout2” selected for my “Expenses layout” template.
Figure 1:


Figure 2:

So, if I want to use the “Layout2” in my “Add a new expense” form, I have to do:

   # Traditional way
    OpenRow(thisRow,[Expenses layout],"Fullscreen")

    # With chaining
    thisRow.OpenRow([Expenses layout],"Fullscreen")

A more advanced use case would be:

#Traditional way
  OpenRow(
    AddRow(Transacciones,
      Transacciones.[Descripción],thisRow.Detail, 
      Transacciones.Fecha,Today(),
      ),
    [Expenses layout],
    "Fullscreen"
  )

#With chaining
Transacciones.AddRow( 
      Transacciones.[Descripción],thisRow.Detail, 
      Transacciones.Fecha,Today(),
      ).OpenRow([Expenses layout],"Fullscreen")

If I select the “Transacciones” table as the argument, it will open the row with “Layout 1”.

I’d rather the “with chaining” way because I think is more readable, but put both options if someone is coming from Excel like formulas.

Do you think I should open a new topic explaining this?

1 Like

It seems someone have already walk through this process.