Store Content in IDOL Server > Process Data before you Index > Use Lua Script Index Tasks > Find the Name of a Field

Find the Name of a Field
The function getFieldName returns the name of a field when you pass in a field object. For example, you can use it to search for a field using a wildcard value, or use this function in combination with fieldGetParent to return the name of a parent field.
Examples:
for ii,field in ipairs { document:findField(“METADATA/*”) } do
local fieldname = document:fieldGetName(field)
...
end
This example loops through all children of the METADATA field and processes them according to the name of the child fields.
local parentname = document:fieldGetName(
document:fieldGetParent(
document:findField(“*/FIELDNAME”)
)
)
This example finds the name of the parent field of the FIELDNAME field.