MerginMaps / MerginMaps/mobile

Photo attachment filename expression is evaluated at a different time than field expressions, causing mismatched names

Open
#4,099 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
C++
Stars
388
Forks
87
Avg merge
2d 7h
Merged PRs (30d)
20

Description

### Steps to reproduce

1. In QGIS Project Properties
Configure Photo attachments → File name expression to:
```
replace(@layer_name,' ','') || '-' || @mergin_username || '-' ||
format_date(now(),'yyyyMMdd_HHmmss')
```

2. Add a text field photo_url whose default/value expression is:
```
'/CORPORATE-DRIVE/' ||
replace(@layer_name,' ','') || '-' || @mergin_username || '-' ||
format_date(now(),'yyyyMMdd_HHmmss')
```

3. Create a new feature and take a photo.

### Actual result

The saved photo filename and photo_url differ by a few seconds, indicating the two expressions are evaluated at different times.

### Expected result

Both should match when they are logically based on the same expression.

### Why it matters

Downstream fields that depend on the photo name (e.g., paths/URLs) become inconsistent.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the mismatch using the Photo attachments file name expression and the photo_url field's default/value expression in QGIS Project Properties. Trace where each expression is evaluated during feature creation and photo capture, then verify that both filenames use the same timestamp when the reproduction steps are repeated.

Written by the indexing model from the issue text.

Assessment

Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.