> For the complete documentation index, see [llms.txt](https://learn.vispeahen.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.vispeahen.com/kumanda-tablosu/oturum-degiskeni/4.-adim-adim-oturum-degiskeni-olusturma.md).

# 4. Adım Adım Oturum Değişkeni Oluşturma

Aşağıdaki adımlar, veri modeli ekranındaki SV butonundan başlayarak oturum değişkeninin tanımlanıp kaydedilmesine kadar tüm süreci kapsar.

{% stepper %}
{% step %}

### Adım 1: Oturum Değişkeni Ekranını Açma

Veri modeli ekranına gidin (Modeller penceresi). İlgili model seçiliyken (örnekte **Perakende E-Ticaret Model**), model seçim satırının sağ üst köşesindeki SV butonuna tıklayın.

<figure><img src="https://3143653407-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0vZHisAf5833eglFw2GE%2Fuploads%2F7Py1vN87I7rMUyewwBJn%2Fimage.png?alt=media&amp;token=e1a5386e-52dc-42b1-ac9e-2db7e1d65cd1" alt=""><figcaption><p><mark style="color:$primary;"><strong>Görsel 4.</strong></mark> <em>Model seçim satırının sağ üst köşesindeki SV butonu.</em></p></figcaption></figure>
{% endstep %}

{% step %}

### Adım 2: Yeni Oturum Değişkeni Ekleme

Açılan **Oturum Değişkenleri** ekranında mevcut oturum değişkenleri **İsim**, **Varsayılan Değer** ve **İşlemler** sütunlarıyla listelenir. Var olan bir oturum değişkenini düzenlemek için satırdaki kalem, silmek için çöp kutusu ikonu kullanılır. Yeni bir oturum değişkeni oluşturmak için sağ üstteki **Ekle** (Add) butonuna tıklayın.

<figure><img src="https://3143653407-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0vZHisAf5833eglFw2GE%2Fuploads%2FBng0fYovBaICSTatNpMz%2Fimage.png?alt=media&amp;token=9900acf5-d14f-4d93-8a88-a91ee27675bb" alt=""><figcaption><p><mark style="color:$primary;"><strong>Görsel 5.</strong></mark> <em>Oturum Değişkenleri ekranı — Ekle butonu ve İşlemler (düzenle/sil) ikonları.</em></p></figcaption></figure>
{% endstep %}

{% step %}

### Adım 3: Oturum Değişkeni Editörü

Açılan **Oturum Değişkeni Editörü** ekranında değişkenin tüm özellikleri tanımlanır:

* **İsim:** Değişkenin adı (örnekte `perakende_sv`). Bu ad, ilerleyen adımlarda `${session.perakende_sv}` biçiminde referans verilirken kullanılır.
* **Veri Tipi:** Değerin tipi — örnekte **Metin**.
* **Varsayılan Değer:** Sorgu bir sonuç döndürmezse kullanılacak yedek değer (örnekte `kullanici`).
* **Çalıştırılma Zamanı:** SV sorgusunun ne zaman koşacağı — örnekte **Kumanda Tablosu Yüklenirken**.
* **Bağlantı:** Sağ paneldeki **Bağlantılar** listesinden sorgunun koşacağı veri kaynağı seçilir (örnekte **Vispeahen Perakende Eticaret**).
* **SQL:** Orta paneldeki editöre, kullanıcıyı kırılıma göre bölen sorgu yazılır. Örnekte oturum açan kullanıcının görebileceği il kodları döndürülür:

```sql
select distinct city_code
from perakende_sv
where username = :username
```

<figure><img src="https://3143653407-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0vZHisAf5833eglFw2GE%2Fuploads%2FXNu8n8aRNy6HgKtqeSRE%2Fimage.png?alt=media&amp;token=f89cca2d-076c-4135-9b96-81de409d7fac" alt=""><figcaption><p><mark style="color:$primary;"><strong>Görsel 6.</strong></mark> <em>Oturum Değişkeni Editörü — İsim, Veri Tipi, Varsayılan Değer, Çalıştırılma Zamanı, Bağlantılar ve SQL editörü.</em></p></figcaption></figure>

{% hint style="warning" %}
**Not:** Sorgudaki `:username`, o an oturum açan kullanıcının adıyla otomatik doldurulur. Böylece her kullanıcı için yalnızca kendi yetkili olduğu `city_code` değerleri döner.
{% endhint %}
{% endstep %}

{% step %}

### Adım 4: Sorguyu Test Etme (Çalıştır)

Sol alttaki **Çalıştır** butonuna tıklayarak sorguyu test edin. Dönen il kodları alttaki **Sorgu Sonucu** panelinde görüntülenir; böylece oturum değişkeninin doğru değerleri döndürdüğü kaydetmeden önce doğrulanır.
{% endstep %}

{% step %}

### Adım 5: Kaydetme (Uygula)

Sağ alttaki **Uygula** butonuna tıklandığında değişken kaydedilir ve bir önceki **Oturum Değişkenleri** listesine geri dönülür. Yeni oturum değişkeni artık listede görünür.
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://learn.vispeahen.com/kumanda-tablosu/oturum-degiskeni/4.-adim-adim-oturum-degiskeni-olusturma.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
