SPONSORS:






User Tag List

Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Apr 2008
    Posts
    57
    Post Thanks / Like
    Blog Entries
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Date function in Load runner

    Hi,

    In my application I want to select start date & end date for adding recurring payment.

    Start date: Only Friday date is enabled.
    End Date: Only Friday date is enabled.

    Note: Start & End date should not be same.

    I use the below code, For End date when I use the start date as variable it throws an error as "Error 32 type error in argument 2 to `lr_save_datetime'; found `pointer to char' expected `int'.


    I tried with atoi/atol but it taking as integer. can anyone please give solution im new to LR?

    Start date:
    lr_save_datetime ("%Y-%m-%d", DATE_NOW+(ONE_DAY*2), "p_StartDate");
    lr_output_message ("Start Date is %s", lr_eval_string ("{p_StartDate}"));
    End Date
    lr_save_datetime ("%Y-%m-%d", lr_eval_string ("{p_StartDate}")+(ONE_DAY*7), "p_EndDate");
    lr_output_message ("End Date is %s", lr_eval_string ("{p_EndDate}"));


    I have attached full code screenshot for your reference.

    Thanks in Advance
    Attached Images Attached Images
    Last edited by jagantest; 08-23-2016 at 11:34 PM.

  2. #2
    Member GoogleMonster's Avatar
    Join Date
    Jan 2007
    Posts
    173
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    The problem is you are trying to use (and perform arithmetic on) a string as the second operand in the EndDate save date time. That operand is required to be an int, not char as you have it in your code.

    Given that from your logic start date is current date +2 days, and end date is current date +2 +7 wouldn't the following be a simpler way to do this?

    // Start date:
    lr_save_datetime ("%Y-%m-%d", DATE_NOW+(ONE_DAY*2), "p_StartDate");
    lr_output_message ("Start Date is %s", lr_eval_string ("{p_StartDate}"));

    //End Date
    lr_save_datetime ("%Y-%m-%d", DATE_NOW+(ONE_DAY*9), "p_EndDate");
    lr_output_message ("End Date is %s", lr_eval_string ("{p_EndDate}"));


    Having said that a much, much easier way would to be use date/time parameters to do the same thing:
    Define parameter p_StartDate as:
    Parameter Type: Date/Time
    Date/Time Format: %Y-%m-%d
    Check offset parameter by 2 days

    Define parameter p_EndDate as:
    Parameter Type: Date/Time
    Date/Time Format: %Y-%m-%d
    Check offset parameter by 9 days

    Then just use those in your script.
    lr_output_message ("Start Date is %s", lr_eval_string ("{p_StartDate}"));
    lr_output_message ("End Date is %s", lr_eval_string ("{p_EndDate}"));
    Last edited by GoogleMonster; 08-30-2016 at 03:22 PM.
    You're not paranoid if they really are out to get you.

 

 

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 11.11%
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 11:51 AM.

Copyright BetaSoft Inc.