Persisting changes in Data Grid

コメント

6件のコメント

  • Avatar
    sysberry GmbH

    Hi Ivan,

    why don't you use the list view control for that? List View control was specially designed for make all CRUD (Creat, Read, Update, Delete) actions. In form based app you can't use data grid, or subforms for performing CRUD actions as far as i understand the logic of the form based app.

    P.S. by the way, are you from russian speaking land? :)

    Regards,

    Alexey

    0
    コメントアクション パーマリンク
  • Avatar
    Ivan Kuchumov

    Hi Alexey,

    This is process-driven application, so there's no listview control for task forms (at least, I couldn't find it). What I pretended was adding two datagrid controls, one would load items from DB, and you could filter and move selected items to the second datagrid, so I created two tables in the db, one for available and another for selected items (I suppose, there a nice way to do this using javascript, but I don't have much expertise in it). My idea was that a user can delete an item from the available items table, so that it would be inserted using a trigger into the selected items table. But unfortunately, deleting items in datagrid doesn't produce any effect on the db table.

    PS: yes, I'm Russian living in Spain :)

    Kind regards,

    Ivan

    0
    コメントアクション パーマリンク
  • Avatar
    sysberry GmbH

    Sorry, i misunderstood the type of the app. In process based app you can load data in subform or also add a datasource and bind the table directly. In the second way i guess it will work CRU actions, but i am not sure about delete-one. If you just use subform and autolookups, then you will need to do CRUD actions manually after the form.

    PS: hello from Russian living in Germany ;) if you want, we can connect in LinkedIn (see my profile). Could be a lot of topics to discuss :)

    Regards,
    Alexey

    0
    コメントアクション パーマリンク
  • Avatar
    Ivan Kuchumov

    I also tried it with a subform, but it doesn't push the delete action this into the db as well.

    Regards,

    Ivan

    0
    コメントアクション パーマリンク
  • Avatar
    Loren Bratzler

    I have a few applications which use a Data Grid to maintain data in a table.

    The Data Grid control will pull in data from your database (based on lookup criteria) and the data is then being held in the schema for the form.  There is no further connection with the database after the initial load.  So any updates you make in the Data Grid are only being done within the form's schema.  What you have to do is add a database activity to do a Batch Insert back into the table after the form is submitted.

    I don't know if you are familiar with the database Batch Insert activity but there is an option in the activity to delete existing records and then it will insert the updated records from the form's schema back into the table.

    So essentially, the Data Grid takes a snapshot of the data when the form loads.  The user can then manipulate the data in the grid (updating, adding, deleting records) thus creating an updated snapshot of the data.  Then the Batch Insert activity replaces the old snapshot with the updated snapshot.

    One thing to keep in mind is that if the Lookup that populates the Data Grid has restriction criteria on what records it is pulling from the table, you will want to make sure that the Batch Insert also has those same restrictions on which existing records it is going to delete.  So for example, if your Data Grid was loading records from the database where Department = 'ABC', then in the Batch Insert, you will want to tell it to only delete existing records where Department = 'ABC'

    Hopfully this makes sense!  It can be a little hard to explain.

    0
    コメントアクション パーマリンク
  • Avatar
    Ivan Kuchumov

    Hi Loren, thanks for your input.

    Yes, I'm using the Batch Insert activity after the form has been submitted, but what I wanted to get was a user friendly way to select records from a large list with search options. My idea was to have two data grids, one populated with data from a database, so that when you clicked on a row, it should push this entry into the second data grid, and it should be removed from the first list, and viceversa: if you removed an entry from the second list, it should be shown again in the first list. I was thinking of achieving this effect using db auxiliary tables.

    In the end, I got a similar functionality with one subform with custom filter fields and adding a checkbox column to select entries, which I later in the process push into the database with the Batch Insert activity. It works well, but with the only inconvenience that if you have many pages, you can't review at a glance all the selected entries, so I'm thinking to add a javascript to show the selected entries in a html table.

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。