# Scenario Editor Store Target and Post-processing

You can use the Store tab in the scenario editor to define extractors that can "listen" for a particular Step and Request and extract data of its response.

When creating a Store entry or an Assert entry in the Scenario Editor, you need to configure the Target depending on the type of response.

Also, you might require to apply some post-processing to the response. In this document, you will find examples of the possible values that can be used for the Target and the Post-processing inputs.

# PostProcessing

Here is a list of examples of all the possible functions that can be used for post-processing entry.   
value() returns the extracted value.

> ```
> substring(value(), 0, 2)<br></br>substring(URLEncode(value(), 2)<br></br>URLEncode(value())<br></br>URLDecode(value())<br></br>append(value(),"-abc123")<br></br>length(value())<br></br>URLParam(value(),'id')
> ```

# Target

In the same way, the TARGET can have a hint text that should be dynamic according to the selected Target.  
The // characters indicate a comment and is not part of the target, with the exception of the HTML target that is an XPath.

#### DEFAULT Targets

> ```
> duration        //  returns the request duration<br></br>responseCode   //  returns the response status code<br></br>size           //  returns de size in bytes of the response<br></br>md5            //  returns checksum md4 value of the response
> ```

#### HTTP Targets

Given the response is the following string: "**data=45, data=68**" then

> ```
> raw/data[0]              //  returns 'data=45' and "raw/data[1]" returns 'data=68'<br></br>#data                    //  returns 45<br></br>Header:Accept            //  returns de value of the header Accept<br></br>CookieValue:CSRF-TOKEN   //  returns de value of the cookie CSRF-TOKEN
> ```

#### HTML Targets

Use normal XPaths to extract values from HTML. Note that in this case the double slash at the beginning is needed in the target.

> ```
> //input[@name='__RequestVerificationToken']/@value
> ```

#### JSON Targets

Use JSON paths to extract values from JSON responses, like

> ```
> employees[0].address.city<br></br>[2].carousel.images[1].path
> ```

#### PDF Targets

> ```
> document                           // gets all text in document except forms text<br></br>page[2]                            // returns al text in page 2 except forms text<br></br>documentforms                      // gets a json with contents of the forms in the document<br></br>regex:Once upon a .* ever after.   // returns text that matches the regular expression if found.
> ```

#### STRING Targets

Given the response is the following string: "**The tested processed returned: ID=ABCDEF.**" then

> ```
> 11,20"         // returns "processed"<br></br>ID=,false      // returns "ABCDEF."<br></br>ID=,true       // returns "ID=ABCDEF."<br></br>ID=,38,false   // returns "ABCDE"<br></br>ID=38,true     // returns "ID=ABCDE"
> ```

#### TEXT Targets

The target should be specified as a regular expression, like:

> ```
> (?<=\"__RequestVerificationToken\" type=\"hidden\" value=\")[a-zA-Z0-9\\-_]+   <br></br>id=.*
> ```

#### CSV Targets

Given that you have a response formatted as a CSV with the following data

<div id="bkmrk-id-name-state-1-john"> <table> <colgroup> <col></col> <col></col> <col></col> </colgroup> <tbody> <tr> <th>id</th> <th>name</th> <th>state</th> </tr> <tr> <td>1</td> <td>john</td> <td>California</td> </tr> <tr> <td>2</td> <td>barry</td> <td>Nevada</td> </tr> <tr> <td>3</td> <td>stef</td> <td>Texas</td> </tr> <tr> <td>4</td> <td>karla</td> <td>New York</td> </tr> </tbody> </table>

 </div>Then:

> ```
> 2,2                 // returns barry<br></br>last(),"name"       // returns karla<br></br>,"name"             // returns a string array {"name","john","barry","stef","karla"}<br></br>3,last()            // returns Texas<br></br>id=3, 2             // returns stef
> ```
> 
> ```
>  
> ```

<div id="bkmrk-last-updated%3A-june-0">---

Last updated: <span class="mc-variable General.NewDateTimeVariable variable">June 02, 2023</span>

If you have any feedback on this topic, please contact us at <documentation@appvance.ai>

</div>