SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    May 2011
    Location
    California, US
    Posts
    306
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Consuming huge time to add key,value to a dic obj

    Hi All,

    I am trying to add key value pairs using a dictinary object.
    I have the key's and values in a excel sheet, with Keys in one col and values in second col

    I am importing the excel sheet and adding the key value pairs but its taking a huge time to load few values also.

    I am using the below code:

    set objDic=createobject("scripting.dictionary")

    datatable.import <excelsheet>,"Sheet1","dSheet"

    for i=1 to datatable.getsheet("dSheet").getParameter("sKey"). getrowcount
    tempkey=datatable.getsheet("dSheet").getParameter( "sKey").valuebyrow(i)
    tempValue=datatable.getsheet("dSheet").getParamete r("sValue").valuebyrow(i)

    objDic(tempkey)=tempValue
    next

    Please let me know if there is any other approach which can reduce the execution time.
    I use this dic obj at some other places where i want to rename the parameter names in an excel sheet which match with the objdic(key) to objdic(value).
    But adding key value pairs is taking a huge time, so please let me know how can i reduce the execution time.


    Thanks,
    Vijay
    --
    Vijay

  2. #2
    Advanced Member venu.adhikesevan's Avatar
    Join Date
    Jun 2010
    Posts
    517
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0

    Re: Consuming huge time to add key,value to a dic obj

    Try to use ADODB using XLs, It will be so quick to get data from Excel
    use the below link for code
    http://www.sqaforums.com/showflat.ph...mp;Main=618370
    Venu
    Today is always better than Tomorrow
    My Blog
    My LinkedIn

  3. #3
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Consuming huge time to add key,value to a dic obj

    It is not the dictionary object that is taking time. It is your DataTable object that takes a lot of time in the loop.

    As mentioned you should look at using ADODB or something for reading the sheet

  4. #4
    Member
    Join Date
    May 2011
    Location
    California, US
    Posts
    306
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Consuming huge time to add key,value to a dic obj

    ohk.
    I am not sure of using the ADODB Connection for reading excel sheet, so can you please let me know the syntax for connecting to MS Access 2003, with which the key value pairs can be added to the dict obj.

    Thanks,
    Vijay
    --
    Vijay

  5. #5
    Member
    Join Date
    Jul 2011
    Location
    India
    Posts
    381
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Consuming huge time to add key,value to a dic obj

    datatable.Import method takes only one argument!
    you might be looking for datatable.ImportSheet!
    <font color="blue">[i]If there is no struggle, there is no progress!

  6. #6
    Member
    Join Date
    May 2011
    Location
    California, US
    Posts
    306
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Consuming huge time to add key,value to a dic obj

    Yes..I am using datatable.importsheet ..Typo error
    --
    Vijay

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:39 PM.

Copyright BetaSoft Inc.