Skip to content
Discussion options

You must be logged in to vote

Hi @GeePa67

Could you please try the following:

If you just want to read the values:

for c in opensak.caches{ fields = { "name", "custom" } } do
    print(c.code, c.name, c.custom.Identifier)
end

Or for update:

opensak.define_custom_field{ name = "Identifier", type = "string" }

opensak.transaction(function()
    for c in opensak.caches{ fields = { "name", "custom" } } do
        local current = c.custom.Identifier          -- exact case, as defined
        local number  = c.name:match("(%d+)")        -- e.g. "Series #12" -> "12"
        if number and current ~= number then
            opensak.update(c.code, { custom = { Identifier = number } })
        end
    end
end)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@GeePa67
Comment options

Answer selected by GeePa67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
FAQ
Labels
None yet
2 participants