Column customisation in the index window

8 views
Skip to first unread message

Richard Blake

unread,
Jul 5, 2024, 7:59:03 AM7/5/24
to GEDitCOM II Discussions
Hi

I am looking for a particular way of customising a column in the index window.

In my file, I have something like the following

1 IDNO AAAA-BBB

2 TYPE FamilySearch

1 IDNO 123456

2 TYPE Military Service Number


I would like to add a column where the value of all Military Service Numbers is printed. In this case I know that I can use IDNO.i.2 but the order may be different in other records.


So I am wondering, and I think I know the answer, is there a way of printing the value of a structure where a subordinate structure has a particular value. This could be useful in other structures such as EVEN or REFN which also can have multiple uses in one record.


Thanks


Richard

John Nairn

unread,
Jul 5, 2024, 12:08:29 PM7/5/24
to geditcom-ii-discussions@googlegroups.com geditcom-ii-discussions@googlegroups.com
It is not possible in current index window. Unlike extensions that use a script and can do conditionals like

   if @INDO.TYPE = “Military Service Number”
      do want you want
   endif

index columns are just a single expression. Perhaps a future feature could attach a mini script to each column instead of just a single expression? (see below).

You could write an extension that goes through all records and finds military service numbers. Here is start of an internal script for that task:

! Get front document and list of its individuals
gcapp.get gdoc,frontDocument
gdoc.get indis,individuals

! loop over all individuals looking for INDO
! with TYPE = "Military Service Number"
Repeat "#i",0,@indis.count-1
  indis.#i.findStructures indnos,"IDNO"
  Repeat "#j",0,@indnos.count-1
    indnos.#j.evaluateExpression "#type","TYPE"
    if #type="Military Service Number"
      write @indis.#i.name&": "&@indnos.#j.contents&return
    endif
  EndRepeat
EndRepeat 

This script just writes results to the scripting panel, but could be revised into creating a report with links to each individual with a service number.

But your email raises the idea of attaching internal scripts to index columns in place of a column expression. A minis script might be:

  record..findStructures indnos,"IDNO"
  Repeat "#j",0,@indnos.count-1
    indnos.#j.evaluateExpression "#type","TYPE"
    if #type="Military Service Number"
      return @indnos.#j.contents
    endif
  EndRepeat
  return “"

The idea would be that when the index window wants text for any record, it calls such a script with “record” set to the record for that row. The script then either returns some text or returns an empty string. The concern is that running a script for every record might be slow. This option is clearly unworkable with either AppleScripts or Python scripts because they always have second or two delay each time they run. But internal scripts start immediately. It is worth testing if it works. I will try it out and see (maybe in a future version).

John

--
You received this message because you are subscribed to the Google Groups "GEDitCOM II Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geditcom-ii-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geditcom-ii-discussions/004de83b-09b2-47ae-aa9b-cd6696647cb5n%40googlegroups.com.

Richard Blake

unread,
Jul 5, 2024, 12:42:13 PM7/5/24
to geditcom-ii...@googlegroups.com
Hi John

I was pretty sure that what I was asking for was not possible currently.

Attaching a script to the column as an option sounds interesting. I guess it comes down to speed, especially for large files.

Regards, Richard

You received this message because you are subscribed to a topic in the Google Groups "GEDitCOM II Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/geditcom-ii-discussions/jXxnO6jI-Jg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to geditcom-ii-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geditcom-ii-discussions/BDD8CCA6-A663-40BA-99A3-2EDAC6839562%40gmail.com.

Reply all
Reply to author
Forward
0 new messages