# SQLite: Excluding the Unique ID from the Field list

**URL:** <https://forum.xojo.com/t/sqlite-excluding-the-unique-id-from-the-field-list/50034>\
**Category:** Databases\
**Created:** [August 28, 2019, 10:48am UTC](https://forum.xojo.com/t/sqlite-excluding-the-unique-id-from-the-field-list/50034 "2019-08-28T10:48:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [August 28, 2019, 10:48am UTC](https://forum.xojo.com/t/sqlite-excluding-the-unique-id-from-the-field-list/50034/1 "2019-08-28T10:48:00Z")

</div>

I wanted to fill a PopupMenu with a Table Field Names. I searched in the LR (both local and @ docs), but was not happy with the result: something easier must exists (I was thinking).

It tooks me time (one hour) to find the following:

[code] Dim Record\_RS As RecordSet  
Dim colName As String

// Get a RecordSet with the Fields definitions for a TABLE (called List\_Data)  
Record\_RS = Data\_Base\_DB.FieldSchema(“List\_Data”)

// How many Fields in a Record ?  
Field\_Cnt = Record\_RS.RecordCount - 1 // 0-based value

```
Dim Foo as Variant

// Foo = Record_RS.IdxField(3).BooleanValue // *
Foo = Record_RS.Field("isPrimary").BooleanValue // *

If Foo Then // Was something else at start, but I was unsuccessfull, so I used a Variant :(
  // Do not add the Unique ID (Primary Key) name into the PopupMenu
  
Else
  // Fills the PopupMenu
End If[/code]

```

- Surprise: Both lines gives me the same result: the Primary ID Field name is excluded from the list of available Columns names.

This coding design was not built in my brain, but at last I found it.  
If you want to do the same, clears the Variant part (Foo) and use directly the relevant code:

a. `If Record_RS.IdxField(3).BooleanValue Then`  
b. `If Record_RS.Field("isPrimary").BooleanValue Then`

The code in b. is my prefered (more explicit at reading time).

FWIW.

PS: The PopupMenu is part of a `Search <String> in Column <ColumnName>` feature.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 4:04pm UTC](https://forum.xojo.com/t/sqlite-excluding-the-unique-id-from-the-field-list/50034/2 "2021-04-29T16:04:21Z")

</div>


