Getting data from navigator search fields

Build 1501 on 14/Nov/2017  This topic last edited on: 21/Mar/2016, at 18:34

Note: it works only for referenced values, there are no simple method to get other values, such as string, dates, Booleans etc.

This is an example on how to get data from navigator search fields.

In this particular case we want to get content of the Edition field on the search pane Search, on the Pages navigator of the Pages main tab. On the search pane, the field is declared as page.edition.Ref.

Click to toggle graphic size

The code to use is:

Dim currentValues As ICurrentValues = Main.GetCurrentValues(Nothing)

Dim edValue As Object = Nothing

currentValues.TryGetValue("[page.editionRef]", edValue)

The last line reads the value of page.editionRef. If the value is not specified, e.g. you didn't enter anything in the field, edValue will still be Nothing.

The whole script is:

Public Sub PageEditionRecover()

    Dim currentValues As ICurrentValues = Main.GetCurrentValues(Nothing)

    Dim edValue As Object = Nothing

    currentValues.TryGetValue("[page.editionRef]", edValue)

 

    If edValue IsNot Nothing AndAlso TypeOf edValue Is Integer Then

      Fred.RecoverDlg(DirectCast(edValue, Integer))

    End If

  End Sub

See also

Putting data in navigator search fields