Results 1 to 6 of 6

Thread: Random vs. Sequential access

  1. #1
    Junior Member
    Join Date
    Oct 2007
    Answers
    14

    Random vs. Sequential access

    Hi all!

    I would need help in the following topic:

    Let me have a File or Table type parameter calles myList
    (it looks like this:
    IDs
    11
    22
    33
    44
    55
    ...)

    What if I don't want to access the data every time Randomly? So for example I would need to get the first data in every iteration randomly, but in the same iteration I want the second data to get sequentally.

    So for exemple the data what I want in 3 iterations:
    22 and 33
    66 and 77
    11 and 22

    How can I solve this problem?
    I could ask the same same with other words:
    - can I reach the data in the parameter files DIRECTLY
    or
    - can I switch the access type (random or seq.) of a parameter file during execution?

    ps: of course the lr_next_row() and the lr_advance_param() funcions cannot be used for this, because these are using the initial type of the access. So if I have a random access, than these functions will give me the second data also randomly.

    Thx for the help!
    PalEE


  2. #2
    Contributing Member
    Join Date
    Sep 2007
    Answers
    50

    Re: Random vs. Sequential access

    Hi PalEE,

    That is a good question. After looking through the function reference, I only see one function that may help you.
    lr_next_row(char*);

    Please try it out and let us know how you get this to work as I would like to know.

    Thanks,


  3. #3
    Junior Member
    Join Date
    Oct 2007
    Answers
    14

    Re: Random vs. Sequential access

    ... yes, this is the good thing in this question, that (as I know) there is no evidential solution for it in the funtion reference. I also checked them

    So...

    For example, if I have a perameter file called "nums.dat" and it contains the data what I wrote before, than the next row function would be this:

    lr_next_row("nums.dat");

    But if the base access is random, then this function gives back the next RANDOM data. So for example the first one is the 33, and I would need here the 44, but the lr_next_row(...) gives back for example the 99.

    The other similar function is the lr_advance_param(...). This does almost the same as the lr_next_row(...). The only difference is, that if U have a param file with many columns than the lr_advence_param(...) steps only one element (so for example to the next column), but the lr_next_row(...) steps to the next row (not only one element). But the problem is, that both of them do the step according to the base access type of the param file, and if it is a random access.... than the next element will also be a random one.

    The funny is, that I saw a task from an official LoadRunner exam (example), where the base problem was this, what I wrote down.
    I "can" solve this problem, but only with some restrictions and workarounds, but it is not what I want

    So the question is still here... can I access directly to the parameters files? The best would be if I could say something like that:
    char* lr_get_data( char* paramFileName, int rowNum, int columnNum)
    And whit this I could reach the data directly.

    Of course U can say, that lets code it in C.... but first of all I don't like C (ok, it is not true, but C is complicated ), and 2: during an exam U shouldn't start to write quite big C functions. If I'm not right, tell me!

    Thanks for the help
    (the Q. is already open)


  4. #4
    Contributing Member
    Join Date
    Sep 2007
    Answers
    50

    Re: Random vs. Sequential access

    Hi,

    You are absolutely right, LoadRunner is supposed to supply all of the functionality that you need to create scripts using only it's API (or so they say )

    I saw lr_advance_param(), and lr_next_row().....the function reference makes it seem like lr_next_row() does what you want it to do....that's too bad that it still uses the "SelectNextRow=Random".

    If the data has the pattern that you are suggesting, you can always manually create a new parameter by converting the current parameter into an integer, adding 11 to it, and copying the next integer into a new parameter.

    If not, then creating your own C code to do this is the only thing I can think of.


  5. #5
    Junior Member
    Join Date
    Oct 2007
    Answers
    14

    Re: Random vs. Sequential access

    Of course this data file was just an example for easier understand.
    So the solution is an own C function.

    I have to mention, that this could be quite difficult to implement, if U wanna have the possibility what the original parameters have (for example random access).

    Thx,
    PalEE


  6. #6
    Junior Member
    Join Date
    Dec 2009
    Answers
    3

    Re: Random vs. Sequential access

    Hi,

    Can u show me your script. how did u put that function. because i also need to do the same. but i dont know how and where it should place. Thanks.

    Amilar


    Quote Originally Posted by PalEE View Post
    Hi all!

    I would need help in the following topic:

    Let me have a File or Table type parameter calles myList
    (it looks like this:
    IDs
    11
    22
    33
    44
    55
    ...)

    What if I don't want to access the data every time Randomly? So for example I would need to get the first data in every iteration randomly, but in the same iteration I want the second data to get sequentally.

    So for exemple the data what I want in 3 iterations:
    22 and 33
    66 and 77
    11 and 22

    How can I solve this problem?
    I could ask the same same with other words:
    - can I reach the data in the parameter files DIRECTLY
    or
    - can I switch the access type (random or seq.) of a parameter file during execution?

    ps: of course the lr_next_row() and the lr_advance_param() funcions cannot be used for this, because these are using the initial type of the access. So if I have a random access, than these functions will give me the second data also randomly.

    Thx for the help!
    PalEE



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact