Question

Transfer data list view from Form to SubFrom

  • 7 December 2020
  • 11 replies
  • 228 views

Badge +1

Hi everyone,

I have a form with 2 views (1 item view and 1 list view).

 

What I want to do is an order confirmation. First I fill in the data in the main form and when I click the submit button I want to open the same form (subform) with the data entered so that they can see the details and in case of making a mistake something to be able to modify it.

 

 

I can show the data in the item view, but the data in the list view cannot. Any ideas or is there any other way to do it other than this?

 

Thanks, 

Isaac


11 replies

Userlevel 3
Badge +6

Hi @IsaacLabuena,

Just to clarify, do you need help with creating the subform whereby a user can see and edit an order, or are you trying to do something with the listview?

 

Kind regards

Prineel

 

Badge +1

Hi @Prineel 

 

Thanks for your reply.

I need help to create the subform whereby a user can see and edit an order.

 

Thaks,

Isaac

Userlevel 3
Badge +6

Hi @IsaacLabuena,

 

Okay, theres at least 2 ways (probably even more) of doing this. I will try and reproduce something for you within the next 5 hours hopefully less.

 

Kind Regards

Prineel

Badge +1

Hi @Prineel 

 

 

Thank you for your dedication and if you need anything else or clarify any questions you can contact me!!

 

Kind Regards,

Isaac

Userlevel 3
Badge +6

 Hi @IsaacLabuena ,

 

I have created 2 “options” that hopefully will help you. Option 2 is the easier one so I will be explaining that (to the best of my english). I will also upload a package which you can then deploy and go through everything if you want to.

Option 2: 

  1. First you need to create a form that you will use as your subform, I named mine “Sub Form”:
Note, this is just a normal form that you will use as a subform with the “Open a subform rule”
  1. Next, on your subform, you need to create a data label that you will use to get the ID of the “Order” from your item view (this will be a hidden control). So just drag and drop the data label control onto the blank form.
     
  2. On your original ItemView, create a data label as well (this is going to store the “Order” ID and we will transfer the ID value when the “submit” button is clicked to the data label that we just created on the subform).
     
  3. Still on on the Item View, on the submit button, there are a few things i did:
    Use the create method to save the data to the smart object (this should be there already)
    This is what it should look like at the end

    Set the property of the data label in your item view to the smart object ID:

    Note: You can also just use the “set subform’s control property rule” instead that way you dont have to have a data label in the item view.
    Lastly, use the “open a subform” rule, and configure it:

    Note, if you use the  “set subform’s control property rule” to transfer the ID directly to the suform’s data label then you ignore the data label transfer here.

     

  4. Create a listview from your SMO (this isnt the same one as in your form, this we will use to edit and display the data in the subform):
     

    I dont recommend including the ID field, you will need to have the save method and the “edit all rows” checked.

     

  1. Put the view in your sub form and in “when form is initializing” event(if you dont have it, then create it), add these rules to the event:

    In the get list me, edit only the filter tab, filter the view by the data label:

  2. The results should be something like this:
    Ignore option 1, also take not of the number “10” above the word “Option”, that is the data label to store the ID, you can mark it as invisible to hide it

    So, for option 1, it will be very difficult to explain, but basically i just transfered the data from the item view into texboxes, and when you want to edit them, it reads the ID from the data label and uses the save method just like from in option 2. Let me know if you need any more explantions/help. I cant upload the packaged file here unfortunately as it is not supported, though i will leave a download link by tomorrow, if not today. Hope this helps.

Kind Regards

Prineel

Userlevel 3
Badge +6

Hi,

Here is a one drive link to download the file :)
 

Badge +1

Hello @Prineel, good morning

 

Thanks for your explication! But I think it’s not what I need. But I really appreciate your dedication

I will try to describe with more detail, I have a form with two views:

  1. Header View: ID, date_request, user_request, total_amount…
  2. List View: item_id, item_description, item_price

And when I click the submit button I want open pop up with the details entered in the form before clicking the button. And since these items have not yet been created, I can't find a way to list them in the subform that I open when I click the button.

 

Example Header:

 

Example Item List:

 

And when I click submit button, I want something like this (but with the items in the previous form):

 

 

I think now I have been more specific.

 

Kind Regards,

Isaac

Userlevel 3
Badge +6

Hi @IsaacLabuena,

 

Apologies, I thought that it saved the data to the database when the submit button was pressed, I will try and re-repro it and see if maybe a transfer rule will work. Thanks for the explanation, I have a better understanding of what you are trying to do :)

 

Kind Regards

Prineel

Userlevel 3
Badge +6

Hi @IsaacLabuena,

Just to confirm, the data from the ListView that you want to transfer to the sub form has not been saved to the SMO, but rather just typed in the list view?

 

Kind Regards

Prineel

 

Badge +1

Hi @Prineel 

Exactly that is. If I see that it is very difficult I will try to make a temporary table in SQL to save that data and when I no longer need to delete it.

 

Thanks,

Isaac

Userlevel 3
Badge +6

Hi @IsaacLabuena ,

 

I dont think that it is possible to do it the way that you want to. I think the best alternative is to save it into the SMO when the submit button is clicked, then call the same or another list view into the sub form where the user can edit it if needed. If a user doesnt want to confirm an order, then maybe have a cancel button in the subform that will delete the order (filter by the order ID) record, basically the way I did it the first time. 

 

Kind Regards

Prineel

Reply