Search code examples
performancetestingautomationcorrelationloadrunner

Is it possible to correlate specific ID using Loadrunner?


{"Id":11911618,"LatestAsAtYear":2022,"ParentGroupId":22022,"NoOfBorrowingEntities":4,"NoOfNonBorrowingEntities":1,"SensitivityAccessibility":false,"CustomerGroupTotalLimit":104500001.00,"OPEXPerGroup":165760.00,"OverrideReason":null,"GroupStatusId":0,"GroupSimStatus":"Baseline","CreatedDateTime":"/Date(1675945044793)/","CreatedBy":"System","ModifiedDateTime":"/Date(1675945044793)/","ModifiedBy":"System","AssessedDateTime":"/Date(1675945044793)/","AssessedBy":"System","ApprovedDate":null,"ApprovedBy":null,"Currency":1,"CurrencyName":"MYR","NoOfBorrowingEntity":4,"NoOfNonBorrowingEntity":1,"ARMName":"SYSTEM","ARMAvatarFileId":null,"WithAllRollUpCusSim":true,"Justification":null,"hasOutdatedCusSim":false},

  {"Id":12238948,"LatestAsAtYear":2022,"ParentGroupId":22022,"NoOfBorrowingEntities":5,"NoOfNonBorrowingEntities":16,"SensitivityAccessibility":false,"CustomerGroupTotalLimit":440772000.00,"OPEXPerGroup":301516.00,"OverrideReason":null,"GroupStatusId":1,"GroupSimStatus":"Draft","CreatedDateTime":"/Date(1677812701377)/","CreatedBy":"406038","ModifiedDateTime":"/Date(1677812701377)/","ModifiedBy":"406038","AssessedDateTime":"/Date(1677812701377)/","AssessedBy":"406038","ApprovedDate":null,"ApprovedBy":null,"Currency":1,"CurrencyName":"MYR","NoOfBorrowingEntity":5,"NoOfNonBorrowingEntity":16,"ARMName":"Loh Hui Joo","ARMAvatarFileId":null,"WithAllRollUpCusSim":true,"Justification":null,"hasOutdatedCusSim":false},

  {"Id":12238947,"LatestAsAtYear":2022,"ParentGroupId":22022,"NoOfBorrowingEntities":1,"NoOfNonBorrowingEntities":0,"SensitivityAccessibility":false,"CustomerGroupTotalLimit":100000.00,"OPEXPerGroup":22636.00,"OverrideReason":null,"GroupStatusId":3,"GroupSimStatus":"Completed","CreatedDateTime":"/Date(1677811177550)/","CreatedBy":"406038","ModifiedDateTime":"/Date(1677811192897)/","ModifiedBy":"173660","AssessedDateTime":"/Date(1677811177550)/","AssessedBy":"406038","ApprovedDate":"/Date(1677811192897)/","ApprovedBy":"173660","Currency":1,"CurrencyName":"MYR","NoOfBorrowingEntity":1,"NoOfNonBorrowingEntity":0,"ARMName":"Loh Hui Joo","ARMAvatarFileId":null,"WithAllRollUpCusSim":true,"Justification":null,"hasOutdatedCusSim":false}]}

I am expecting to capture the ID specifically with the Draft staus


Solution

  • ...
    LB="{\"Id\":",
    RB=",\"GroupSimStatus\":\"Draft"
    ORD=ALL,
    ...
    

    This leaves you with a string of

    12238948,"LatestAsAtYear":2022,"ParentGroupId":22022,"NoOfBorrowingEntities":5,"NoOfNonBorrowingEntities":16,"SensitivityAccessibility":false,"CustomerGroupTotalLimit":440772000.00,"OPEXPerGroup":301516.00,"OverrideReason":null,"GroupStatusId":1

    Use your string processing skills in the language of your virtual user to break out the first set of characters up to the first comma and save that to a new variable using lr_save_string()

    The above assumes that the ID will eventually grow beyond eight characters in length.

    If you find that your string you wish to capture has a consistent, non-variable, length, then you should investigate the flags for SaveOffset and SaveLen to capture a subset of eight characters at the front of the correlation region without having to use your additional programming skills to break apart a string