SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Apr 2002
    Location
    San Jose, CA, USA
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Searching on 3 different type records

    I have 3 different records:

    type cpage is record
    STRING token
    STRING key

    type kpage is record
    STRING box
    STRING keyname
    STRING fprint

    type rpage is record
    STRING rtoken
    STRING rprint

    Two of the records read data from two different files, the third record reads data from a webpage.

    I want to do the following in my for loop:

    1. get the rpage[i].rtoken and search for a match in cpage.token.
    2. now that i have cpage.token matched, take the cpage.key associated with it and search for a match in kpage.keyname.
    3. once there is a match, then take the kpage.fprint associated with the match and compare (verify) it against the original rpage[i].rprint

    How would i do this, keeping in mind that I need to know the indexed value of any given record in mind for the next search. I didn't see much doc (as usual) with SilkTest.
    Thanks in advance.

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

  2. #2
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Searching on 3 different type records

    Silk doesn't describe it explicitly because nested loops are a basic construct in any programming language. What might confuse you is the syntax for accessing a single entry in a list of records.

    1. First off lets change the definition of each record type from lowercase:

    type cpage is record

    to upper case:

    type CPAGE_REC is record

    so that you'll be able to easily distinguish between record types and other variables in your source code.

    2. You should also consider adopting hungarian notation so that you can quickly determine the type of each variable:

    This'll enhance readibility during development and aid future maintenance.

    3. Here's some example pseudo code to get you started:

    ** = We could of course code the entire thing for you but then you'd miss out on all the fun and have to mail in your next paycheck to cover software development costs.

    Hope this helps...


    John


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

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    117
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Searching on 3 different type records

    Although you don't say it in your description, I'm assuming that there is a concept of a "single transaction" that needs to be addressed, right? That is, you want to read file 1, read file 2, and a "corresponding" web page and verify that all three are "in sync". Yes?

    In that case, there are at least a couple of scenarios you need to think about:

    1) You do 1 "transaction" at a time, read both files and the web page, THEN verify the result, toss out the data and start again

    OR

    2) You do all of your transactions, building lists of records, then cycle the lists and do the verification at the end

    In case 1, it should be fairly straightforward to do the comparison:

    if rpage.rtoken == cpage.token
    if cpage.key == kpage.keyname
    if kpage.fprint == rpage.rprint
    // success

    In case 2, I think you need to add an additional field to each record to store an artificial "transaction number" so that you can be assured that all the pieces are in synch. Otherwise, I think you run the chance that an rpage.rtoken from the first interaction might match a cpage.token from the 10th interaction, and that's probably not what you want to prove. Or do you?

    You could also address this problem by simply having 1 loop counter ... then use that loop counter for each record -- that is, rpage[i].rtoken == cpage[i].token. This assumes that all the lists are of the same length (your loop counter takes the place of my artificial transaction ID).

    One last possibility (and this gets pretty convoluted, but it all depends on what you're trying to prove in the end) -- as you capture each record, add it to a table in a database (rpageTable, cpageTable, kpageTable), then at the end of the run, do cool SQL to SELECT * from rpageTable ... etc.) to show records that do (or don't) join appropriately.

    Last thought -- if the token is not expected to be a 100% match (that is, you're really looking for a partial match), then you need to use the SubStr() or MatchStr() functions instead of a simple == comparison.

    Hope that gives you some additional ideas on how to address your problem.

    Good Luck!

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

 

 

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 07:14 PM.

Copyright BetaSoft Inc.