This Forum is ARCHIVE only
For LightSwitch questions,
please use the official forums at:

http://social.msdn.microsoft.com/forums/en-US/lightswitch/threads


Update data with Excel
Last Post 26 Jul 2013 12:26 AM by mdrattitude. 4 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
ClemUser is Offline
New Member
New Member
Send Private Message
Posts:5
Avatar

--
18 Jul 2013 06:24 PM
    Hello everybody,

    I'm a quite new user of Lightswitch.
    My client is looking for a way to update data "massively" using an excel sheet.

    I found the extension Excel Importer, but it seems that it allow us only to add new data and not update the current ones with new values.
    I tried to work with the Source code of the Extension to update it, but i'm not even able to build the project ... and i don't know VB.net

    Does anyone know a way to allow users to update data from an excel sheet ?

    Thanks everyone,

    Clément
    CoastalDataUser is Offline
    New Member
    New Member
    Send Private Message
    Posts:12
    Avatar

    --
    19 Jul 2013 12:03 AM
    I think you're going to have to roll your own; I'm working on this myself, and in any event, it seems that the Excel importer doesn't do anything "massively", or at least not well -- I tried to import 127,000 records into a desktop app, and it just causes the client to choke.

    I did roll my own importer, and even did a character by character parse of the records to accommodate fields with quote encapsulated text (which contains commas, preventing a simple split into fields) but I'm still having a problem with the client choking and locking up.

    If I can get past the problem of overloading the client, the leap to finding existing records and then updating them should be relatively easy, just a matter of a few more lines of code.
    KDINNYUser is Offline
    New Member
    New Member
    Send Private Message
    Posts:10
    Avatar

    --
    19 Jul 2013 12:41 AM
    I'm struggling with a similar/related issue.

    I've been tasked with reflecting changes which occur on the server side over to the client.

    So far, I've been able to insert code which 'auto-refreshes' the affected user screen via a timer.

    The problem is that following a Refresh request - the entire screen/all the data elements get re-rendered. Initially - this is fine/acceptable to the user.

    However - as the day progresses and the amount of entries grows - the screen becomes useless - simply displaying the dreaded 'egg-timer' and/or "Please Wait" form.

    I believe the solution is to figure out only which data elements have changed and further - a method of updating just the affected fields rather than the entire set.

    Do please let me know if you have any suggestions.

    Regards,

    KDinNY
    ClemUser is Offline
    New Member
    New Member
    Send Private Message
    Posts:5
    Avatar

    --
    19 Jul 2013 01:11 AM
    My position is far away below you at this time.

    I can still using the Excel Importer which allow my users to import data even if it's not new to be updated.

    After the importation i can run the following code :

    foreach (var entity in this.Formations)
                {
                    if (entity.Details.EntityState == EntityState.Added)
                    {
                        var propertyName = entity.Titre;
                        var exists = (this.DataWorkspace.Optic2000Data.Formations.Where((x) => x.Titre == propertyName).FirstOrDefault() != null);
                        Formation existing = this.DataWorkspace.Optic2000Data.Formations.Where((x) => x.Titre == propertyName).FirstOrDefault();

                        if (exists == true)
                        {
                            existing = entity; // HOW TO UPDATE THIS ?
                            entity.Delete();
                        }
                    }
                }
    (Sorry for the code like this)

    So i get my new entry (entity) which is at the end an Update. I have my old entry (existing).
    How can i "force" the update of the old entry with the value of the new entry ?

    Because I can use : this.DataWorkspace.AppData.SaveChanges() as i find my new entries with the status EntityState.Added.

    If anyone has any idea

    Thanks !
    Clément
    ClemUser is Offline
    New Member
    New Member
    Send Private Message
    Posts:5
    Avatar

    --
    26 Jul 2013 12:26 AM
    Hey guys,

    Anyone can help me to know how i can update an existing item ?

    Thanks
    Clément
    You are not authorized to post a reply.


    Microsoft Visual Studio is a registered trademark of Microsoft Corporation / LightSwitch is a registered trademark of Microsoft Corporation