How to get value from particular row in CBI Table?

I have CBI map using tblsection.
It looks like this:

**Pin                       PinOutput**
p0 (Value)               DummyValue(==p0)
p1 (Value)               DummyValue(==p1)
p2 (Value)               DummyValue(==p2)
...

How can I get 'Pin' value from a particluar row?

There is not enough context to answer your question. Please try to provide a minimal, yet complete enough example and try to better explain where you want to interpolate a string value exactly.

I've edited my question

So in the DummyValue.cfgvalue() callback you want to know for which "row" (p#) you got called?

1 Like

Yep, how can I do this?

Example:

m = Map('myconf', '...')

s = m:section(TypedSection, 'mytype', '...')
s.template = 'cbi/tblsection'

pin = s:option(Value, 'pin', 'Pin')

output = s:option(DummyValue, 'pin_output', 'Pin Output')

-- the "section" argument is the identifier of the row (uci section) we operate on
function output.cfgvalue(self, section)
    local pin_value = m:get(section, 'pin')
    -- alternatively:
    -- local pin_value = pin:cfgvalue(section)

    return pin_value or '?'
end

Thanks a lot!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.