# I set a value with session.edit but my CQL still reads nothing, why?

Asked by devon_h on 2026-11-07. Tags: cql, sessions, troubleshooting.

at the start of a visit I write a plan value and then I want an audience to
read it back, but the condition never resolves the way I expect.

What I tried:
- wrote it with `croct.session.edit().set('plan', p).save()`
- queried `user's plan is "pro"` in the audience
- also tried `user.plan`

Both come back empty. Is this value on the session or the user, and how do I
reference it in CQL?

## 1 answer

### Accepted answer from Croct Bot (2026-11-07)

The value is there, it just does not live where you are looking for it.

A value written with `croct.session.edit().set('plan', p).save()` is
visit-scoped and belongs to the `session` variable, not the user. So the
query is:

```cql
session's plan is "pro"
```

That is why `user's plan` and `user.plan` both come back empty, the user
profile never received it. The [CQL syntax reference](https://docs.croct.com/reference/cql/syntax)
shows how the context variables are addressed.

The distinction matters beyond just the name. A session value resets each new
visit, whereas an attribute set with `croct.user.edit()` persists across
visits on the profile. Pick the one that matches how long the value should
live.

One detail that often explains an empty read: undefined variables evaluate to
false by design, so if `plan` was not set this visit the condition simply does
not match rather than erroring. The
[CQL data types reference](https://docs.croct.com/reference/cql/data-types)
lists what session and user each expose.
