Hi @ZsPapp ,
Thanks for your question! This behavior has to do with how the Query Builder exports the values rather than the titles for pick lists.
For example, with the Agent Variant pick list:
A query will show “Variant” and “Author” in the results:
But when using the Create CSV button without selecting any results, it saves to my system with the “values” and not the “titles” for the pick list:
First Name,Last Name,Var Type,Variants
Grant,Fitzsimmons,0,Variant Name
Grant,Fitzsimmons,2,Author name
The Report & Label system effectively presents the results of a query export in a structured manner, inheriting this behavior as well.
If I setup an expression like this one, it can convert these values for me:
$F{5,107-variants.agentvariant.varType} == 1 ? "Vernacular" :
$F{5,107-variants.agentvariant.varType} == 0 ? "Variant" :
$F{5,107-variants.agentvariant.varType} == 4 ? "Label Name" :
$F{5,107-variants.agentvariant.varType} == 2 ? "Author" :
$F{5,107-variants.agentvariant.varType} == 3 ? "Author Abbrev." :
$F{5,107-variants.agentvariant.varType}
Now it appears like this:
You can do the same anywhere there is a discrepancy between the values and titles! Let me know if you need my help setting this up or if you run into any issues!
I’ve added this case to a GitHub issue tracking this functionality to ensure that the behavior matches what you see in the query results in the future:
opened 03:11PM - 20 Nov 25 UTC
1 - Request
2 - Queries
SeparationFrom6
Most recently, see https://discourse.specifysoftware.org/t/pick-list-items-in-ja… spersoft-labels/3155/2?u=grant:
>Thanks for your question! This behavior has to do with how the [Query Builder](https://discourse.specifysoftware.org/t/query-builder-in-specify-7/289) exports the values rather than the titles for pick lists.
>
>For example, with the Agent Variant pick list:
><img width="480" height="500" alt="Image" src="https://github.com/user-attachments/assets/19864272-add4-43c7-b765-60f912caf6b9" />
>
>A query will show “Variant” and “Author” in the results:
>
><img width="2784" height="360" alt="Image" src="https://github.com/user-attachments/assets/3c0720f6-d48f-46a5-a4ec-11a7f8ab4dca" />
>
>But when using the **Create CSV** button without selecting any results, it saves to my system with the “values” and not the “titles” for the pick list:
>
> ```csv
> First Name,Last Name,Var Type,Variants
> Grant,Fitzsimmons,0,Variant Name
> Grant,Fitzsimmons,2,Author name
> ```
>
> The Report & Label system effectively presents the results of a query export in a structured manner, inheriting this behavior as well.
See https://github.com/specify/specify7/discussions/5713#discussioncomment-11632908 from @maxpatiiuk:
> The heading issue is fixed in #2769.
>
> The rest is because front-end does fancy formatting of the data it received from the back-end. The export is coming from the back-end so it shows you the raw data front-end receives.
>
> A possible solution would be to offload some formatting from the front-end to back-end. Another solution would generate csv export on the front-end (though that would only work for records that are already loaded)
Also https://github.com/specify/specify7/discussions/5713#discussioncomment-11632911:
> Related to #1144 as both concern SQL generation for formatting/aggregating
>Once this is fixed, front-end formatting of query results can be removed (which would also result in slight performance improvements)
From Garth at The University of Michigan:
> We are observing an issue in how picklists are handled in labels & reports in the herbarium database in Specify 7. This issue is confined to pick list fields, as displayed in Specify 7. Specify 6 is displaying as intended.
>
> Picklist values are being displayed in Specify 7 output, whereas picket titles are displayed in Specify 6. Here's an example of the [reports output](https://drive.google.com/file/d/1DTNhX7HKqqiqP-xfEvEegZmWYEkNg8pc/view?usp=sharing) and the underlying [xml report code](https://drive.google.com/file/d/1DTNhX7HKqqiqP-xfEvEegZmWYEkNg8pc/view?usp=sharing).
From @sharadsw:
>Changes made in #5417 can potentially fix issues with agent type and picklist formatting.
> See: https://github.com/specify/specify7/pull/5417#discussion_r1933223181
### Discussed in https://github.com/specify/specify7/discussions/5713
<div type='discussions-op-text'>
<sup>Originally posted by **grantfitzsimmons** January 13, 2023</sup>
<img width="2558" alt="image" src="https://user-images.githubusercontent.com/37256050/212402312-0dbe64d7-4ddb-40ae-8463-73a5fcd8b010.png">
<img width="923" alt="image" src="https://user-images.githubusercontent.com/37256050/212404879-c9110792-8104-42ec-bb21-8a0da77a672a.png">
[query_results_2023-01-13T19 25 25.499648.csv](https://github.com/specify/specify7/files/10414784/query_results_2023-01-13T19.25.25.499648.csv)
> **[Plarson:](https://discourse.specifysoftware.org/t/audit-log-export-displays-query-result-values/990)**
>
> I use the audit log query to gather data for quarterly reports. The query results display nicely in SP7 but when I export the results, much of it is unreadable and I spend a lot of time doing 40-50 find/replace operations to convert table numbers to the table names so that I can see what’s been done over the last 3 months. It would be more useful to export the table names. Likewise with the actions and field names (user-created caption vs, e.g., “text1”).
</div>