# Use Cases for Server Side Variables

Server-side variables can access all the details of the server-side environment, including the local storage on the virtual machine or any value that is submitted from the client-side to your JENTIS server.

### Read and Write Local Storage Properties

With the following server-side variable, you can access an event's property, check the value, and return a result based on it. For this, local storage is very helpful, which can hold information for later use. One example might be a situation where you want to deduplicate transactions that are tracked in your frontend. Sounds interesting? Here is a detailed guide on implementing a server-side deduplication function with server-side variables.

The basic syntax of server-side variables follows this general template:

{% code lineNumbers="true" %}

```javascript
async function(){
  var storage_value = await this.storage.read("storage_name");
  
  this.storage.write("storage_name", "updated value", Date.now()+94608000000);
}
```

{% endcode %}

### Server-Side to Client-Side variable references

This feature enables users to access the value of another client-side variable within a client-side variable. As a result, it is possible to reuse values from existing variables. Furthermore, even references of references of references are achievable.

The reference functionality can be used like this:

{% code lineNumbers="true" %}

```javascript
this.getFrontendVariable("<ID of client-side variable>");
```

{% endcode %}

The ID of a variable can be found in the edit view of the JTM in the property field “ID”.\\

<figure><img src="https://2315305008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy15ncufYr341K5U8q6Of%2Fuploads%2Fgit-blob-c496fb29999855397b140bca2947a27a88afeaad%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
It is important to note that this functionality only works with the JENTIS wrapper scripts we provide.
{% endhint %}

Full client-side variable example for gathering the screen resolution:

{% code lineNumbers="true" %}

```javascript
async function() {
    return this.getFrontendVariable("window_screen_width") + " x " + this.getFrontendVariable("window_screen_height");
}
```

{% endcode %}
