Programmatically access Field Title

Is there a built-in, programmatic way to get at a field’s “Title”?
If there is, I have not found it.

Currently, I’m doing the following to get a field’s “Title”, but it’s prolly a bit overkill.

Let GetFieldTitle =
    |||
    Let title = ""
    Try
        Local lFieldInfo
        fieldblueprint "Inventory", lFieldInfo, Parameter(1)
        Let dict = Execute("FunctionValue "+lFieldInfo)
        title = GetDictionaryValue( dict, "TITLE")
        title = ?(title != "", title, Parameter(1))
    Catch
        nop
    EndTry
    FunctionValue title
    |||

// pass in the field name. eg "PvtData01"
Let title = Execute(GetFieldTitle, "PvtData01")
Message title

If the field exists, and it has a title, the title is returned.
If the field exists, and it has no title, the field name is returned.
If the field does not exist, then an empty string (“”) is returned.

Question: is there a built-in way of accomplishing the same thing?

TIA!

A clue - where do you suppose the blueprint code gets the title? :slight_smile:

The answer is the getfieldproperties( function.

Here’s the code you need to get the title.

getdictionaryvalue(getfieldproperties("PvtData01"),"TITLE")

For your application, I would suggest.

let p = catcherror("", getfieldproperties("PvtData01"))
let title = defaulttext(getdictionaryvalue(p,"NAME"),getdictionaryvalue(p,"TITLE"))

This takes advantage of the fact that the getdictionaryvalue( function will return an empty string if the item doesn’t exist, or the dictionary is empty.