LOGOS 4 COM API - Make more datatypes work with DataTypes.GetDataType

AndyTheGreek
AndyTheGreek Member Posts: 232 ✭✭
edited December 2024 in English Forum

I'm using the API to get the names of all Bible books as follows (Delphi code)

BibleData := LogosApp.DataTypes.GetDataType('Bible').Details as LogosBibleDataTypeDetails;

I can then use FirstBook and NextBook to get a list of all books and I then drill into this to get the chapters for each book and verses for each chapter. In this way I can build a dynamic Bible Reference selection screen.

Fine so far.

BUT - the line GetDataType('Bible') does not allow me to specify which Bible I want. Weirdly, it works for the English Standard Version (GetDataType('BibleESV')) but not for others - GetDataType('BibleNIV') or GetDataType('BibleRSV') return nothing...

The reason for the request is simple - not all Bibles have the same books (Apocrapha etc) or the same verse numberings and I would like to code the verse selector to work with 'typical' Bibles and not so typical Bibles...

So, in other words, I would like every Bible in Logos to have a datatype of LogosBibleDataTypeDetails in the same way that the ESV (apparently) does...

Comments

  • Paul Davey
    Paul Davey Member Posts: 44 ✭✭

    Hi Andy

    If a resource has a datatype "Bible" then I think it will contain the 66 Books.  I don't know why the ESV is different - so is the NASB (NASB is of datatype BibleNASB95).  The datatype is not necessarily tied to the version.  Each version has a datatype - most seem to be "Bible".

    If you want to specify the Bible, you have to specify the resource.  You can get a collection of all the Bibles using the GetResourcesByResourceType(“text.monograph.bible”) method of the Library.  I think you then need to load it into a Panel so you can query it's datatype.

     

    Incidently, I could not get the Library.GetResourceInfo(ResourceId : String) method to work.  It always returned Null.

  • AndyTheGreek
    AndyTheGreek Member Posts: 232 ✭✭

    Paul

    The simple Bible DataType returns the Apocrapha as well. BibleNA27 returns the NT, as expected. However, most of the bible resources just have the type 'Bible' and so I can't easily query Logos for which books are in which particular Bible.

    I'm also uncertain as to how to ask a resource directly what its resource type is - a method GetDataType(resourceID) seems to be missing. GetResourceInfo doesn't tell me this (not that I''ve used this method). Weirdly, if a resource is open, I can ask the panel using GetCurrentReferencesAndHeadwords and can get the data type from that.

    It seems weirdly incomplete - but I may be overlooking something...