SPONSORS:






User Tag List

Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1
    Senior Member
    Join Date
    May 2001
    Location
    Lahore, Punjab, Pakistan
    Posts
    101
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating Record Type Dynamically?

    Hi All!
    Currentl Im facing a problem.I want to fetch database and compare the results.
    The approach Im adapting is from our member vincebrown.Im declaring a record against each table.
    The question is can i construct records dynamically?i.e.Silk Test automatically declares record against each table in DB and the members of this record are columns of the table.



    ------------------

  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    Irvine, CA
    Posts
    157
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Record Type Dynamically?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by NitPicker:
    Hi All!
    Currentl Im facing a problem.I want to fetch database and compare the results.
    The approach Im adapting is from our member vincebrown.Im declaring a record against each table.
    The question is can i construct records dynamically?i.e.Silk Test automatically declares record against each table in DB and the members of this record are columns of the table.
    <HR></BLOCKQUOTE>

    When you say "construct records dynamically", I assume you mean that you want to define record data types dynamically. This is not possible in SilkTest. What you can do is read the data into a LIST OF ANYTYPE variable. This is as close to a record as you will get. Maybe you could provide more detail on what you are trying to do? Then we might be able to offer some better suggestions.

    ------------------
    Matt Gray
    Kofax Image Products
    Matt Gray

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Record Type Dynamically?

    Depending what you want to do. You could in theory make partial dynamic declaration of your script.

    What you do is dynamically create your script. Then run it through command line.


    ------------------

  4. #4
    Senior Member
    Join Date
    Jul 1999
    Location
    Burlingame CA 94010
    Posts
    502
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Record Type Dynamically?

    You can use a LIST OF ANYTYPE if you don't know what type of data you'll be getting back from a query. Then you can check the datatypes of each list element.

    Hope this helps

    ------------------
    John W Green
    jwgreen@automationexpertise.com
    http://www.automationexpertise.com

  5. #5
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Record Type Dynamically?

    Declaring types dynamically is impossible I believe. I have always got by with manually declaring all the record types in an inc file (which has since become an invaluable reference to all the database tables used by our aut); this is possible because the tables used are predefined and fixed, though there are rumours of a new development in our system allowing users to create and modify their own database tables. If this happens then I think we will be forced to redesign the way we verify data in database tables, because we do currently rely on the database table definitions being fixed.
    Is this the problem you're facing NitPicker?

    ------------------

  6. #6
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Record Type Dynamically?

    Stop using records.

    Use list of anytype as suggested by T. Green:P and make it an associative array type. SO you can reference your data by name intead of by index.

    If your record is dynamic in the sense of putting different types together to form that record then you might as well use the list of anytype.



    ------------------

  7. #7
    Senior Member
    Join Date
    May 2001
    Location
    Lahore, Punjab, Pakistan
    Posts
    101
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Record Type Dynamically?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by vincebowdren:
    Declaring types dynamically is impossible I believe. I have always got by with manually declaring all the record types in an inc file (which has since become an invaluable reference to all the database tables used by our aut); this is possible because the tables used are predefined and fixed, though there are rumours of a new development in our system allowing users to create and modify their own database tables. If this happens then I think we will be forced to redesign the way we verify data in database tables, because we do currently rely on the database table definitions being fixed.
    Is this the problem you're facing NitPicker?

    <HR></BLOCKQUOTE>
    Thank all for your valuable suggestion.
    But my problem is as mentioned by vince.
    Vince u r right.
    Now what should i do?



    ------------------

  8. #8
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Record Type Dynamically?

    GodKnows: Using a list of anytype is not so nice a way of doing it; to declare the contents of a list of anytype for this purpose, you would need to remember the exact order of the fields in the database table, and include nulls in your list. If you have complex scripts where you need to refer back to the entries in these lists, then you can only do so by index (e.g. mylist[5]), which will get unmaintainable very quickly. If you have a record, where the fields in the record are named as the fields in the database table you want to work with, then it's so much easier to work with (e.g. myrecord.Unique_id, or myrecord.Close_date).
    NitPicker: I confess, I'm a bit stumped here. The general strategy will need some severe modification if it's going to work. Seeing as you will need to completely generalise for it work on any table, I am wondering if you could declare a complicated record type which would be capable of representing the required information for any record in any table. Something like this perhaps:
    You still have a list of stuff to work with, but it won't be so nasty as working with a bare list, because you have the fieldname and datatype recorded along with the value. In order to make assigning values to such an entity easier, you could put together a function which takes your general_entry, a fieldname and a value, and sort out the fiddly bits. It won't be quite so terse as saying "myrecord.fieldname = <value>", but it won't be too bad.
    But the beauty of this general plan (if it turns out to be viable) is that you can have just one function which takes a general_entry, and then has all the information it needs to find the record in the database table, and check on all the data. It can report back if the fields are different or if you haven't assigned values to some of the 'values' in your general_entry, it can complain if your values are of the wrong datatype (not easily done when working with a list of anytype), and most importantly it can tell you that the record either exists or doesn't, and whether the contents of the record match the values you predicted should be there.
    Obviously a lot more work needs doing on this, but if I were in your position then it could be something to start with.

    ------------------

  9. #9
    Senior Member
    Join Date
    Aug 1999
    Location
    Irvine, CA
    Posts
    157
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Record Type Dynamically?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by vincebowdren:
    GodKnows: Using a list of anytype is not so nice a way of doing it; to declare the contents of a list of anytype for this purpose, you would need to remember the exact order of the fields in the database table, and include nulls in your list. If you have complex scripts where you need to refer back to the entries in these lists, then you can only do so by index (e.g. mylist[5]), which will get unmaintainable very quickly. If you have a record, where the fields in the record are named as the fields in the database table you want to work with, then it's so much easier to work with (e.g. myrecord.Unique_id, or myrecord.Close_date).
    <HR></BLOCKQUOTE>

    Your suggestion raises the exact problem that the original poster is trying to solve. He is trying to not statically declare the record datatypes. We have a data driven aspect of our test scripts that has a similar issue and we use LIST OF ANYTYPE quite effectively. In our case, we are performing some general operations on the list/record and then returning to the calling function which knows what type of record it is expecting.

    ------------------
    Matt Gray
    Kofax Image Products
    Matt Gray

  10. #10
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Record Type Dynamically?

    Why are you creating records dynamically?
    Are you storing all information of your table in a records?

    You can store your record in a file then load it using another script which handles the rest of your script from there.

    If seems hard but it's very easy. Just open your script in notepad and you'll see how the structure of silk .t is.

    [This message has been edited by GodKnows (edited 06-04-2001).]

 

 
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin 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 04:14 AM.

Copyright BetaSoft Inc.