# Is it possible to programmatically select "Color By" field in ParaView Glance?

**URL:** https://discourse.paraview.org/t/is-it-possible-to-programmatically-select-color-by-field-in-paraview-glance/8338
**Category:** Web Support
**Created:** [November 5, 2021, 4:07pm UTC](https://discourse.paraview.org/t/is-it-possible-to-programmatically-select-color-by-field-in-paraview-glance/8338 "2021-11-05T16:07:10Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![johans](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/3ab097/32.png) [@johans](https://discourse.paraview.org/u/johans)
#### Post date: [November 5, 2021, 4:07pm UTC](https://discourse.paraview.org/t/is-it-possible-to-programmatically-select-color-by-field-in-paraview-glance/8338/1 "2021-11-05T16:07:10Z")

</div>

I have made stand alone “views” with Glance importing vtp data using Glance.importBase64Dataset. I would like to programmatically select the first data field (lets say labeled “A”), instead of glance opening with empty data.

If I understand correctly this can be done using the .glance state files. However, as they are binary I can’t really create them before. So I wonder can I somehow just maybe use a simple javascript snippet (after glance has loaded and initialized) to programmatically get the “color by” drop down menu and change the selection?

---

<div class="post-metadata">

### Author: ![Forrest\_Li](https://discourse.paraview.org/user_avatar/discourse.paraview.org/forrest_li/32/1935_2.png) [@Forrest\_Li](https://discourse.paraview.org/u/Forrest_Li)
#### Post date: [November 8, 2021, 4:29pm UTC](https://discourse.paraview.org/t/is-it-possible-to-programmatically-select-color-by-field-in-paraview-glance/8338/2 "2021-11-08T16:29:50Z")

</div>

FYI, the glance state file is actually a zip file containing a JSON state. You should be able to assign a default colorBy that way. Saving a glance file with your desired colorBy state should give you an idea of what to modify.
