Answered

How to use get_rest_value with variable contents.

I have a situation where I have a call to get_rest_value.   It works well, and I extract data from something like this:

<grantBudget>
<applId>2517428</applId>
<dc>10</dc>
<ic>20</ic>
</grantBudget>

But sometimes I get an output that looks like this:

<grantBudget>
<applId>2517428</applId>
<dc>10</dc>
<odc>11</odc>
<ic>20</ic>
<oic>21</oic>
</grantBudget>

And in this case I want to extract out the additional values.   I have a configuration which extracts the first form, but the second form only occurs occasionally.    Is there a good way to do this in Subject7?

 

 

0
8 comments
Avatar
Rex Feizi

William, 

A couple of clarifications/questions: 

1. Could you please elaborate on "extract additional values"? Meaning, suppose you extracted them, do you plan to only do validation, or the test will have a completely new branch? This is key to determining what we should be doing. If it's just a validation, then you can set it up with "Continue with pass", meaning you have a command to check for "oic" If it exists it checks the value for you, if not it ignores it. However, if there is a series of things you need to do after the presence is detected, then we may need to do a conditional. 

2. Is the "occasional" difference in response static? For example, when it happens does it always have the exact same <oic> or it could be other fields? 

Appreciate your response. 

0
Comment actions Permalink
Avatar
William Smith

HI Rex:

For Item 1:

So, if the items "oic" and/or "odc" are present the test will add them to the "ic" and "dc" values then to a comparison with other test values.   If the values are not present, the test will just use the "Ic" and "dc" values to do the comparison.   So a "Continue with pass" would work if the statement would fill in the values which were present.  Then I could check to see if "oic" had a value or not.   The one drawback to this is if the "ic" or "dc" values were not present, that would not be detected by the test.   This could be worked around.

 

For item 2:

The difference in the response is always "oic" and "odc" being present or not.   The values of "oic" are not always the same when it is present. 

 

While there are potentially other ways in the test to determine if the "oic" or "odc" values are present or not, it would involve a fairly complex process.   Especially given the limit of one conditional expression per if statement.

If the above doesn't answer your question let me know.

0
Comment actions Permalink
Avatar
Rex Feizi

William,

The enhancement where get_rest_value reads as much it can and set the non existant fields to null, is going to be implemented in the next release. You will have it the 3rd Thursday of June when NHLBI patches the server.

Thank you for your patience.

—Rex

0
Comment actions Permalink
Avatar
William Smith

Sounds good.  Thanks Rex.

0
Comment actions Permalink
Avatar
Rex Feizi

William, 

This feature is in production now. You will get to use it when NHLBI next upgrades. 

Thanks 

0
Comment actions Permalink
Avatar
William Smith

FYI, I have been able to use this feature and it works well.  

0
Comment actions Permalink
Avatar
William Smith

Thanks to the team for the implementation. 

 

0
Comment actions Permalink
Avatar
Joseph Hamdan

Thanks William!

We're glad that the feature works as expected, appreciate the feedback.

Enjoy the rest of your day!

Regards,
Subject7 Team

0
Comment actions Permalink

Please sign in to leave a comment.