Skip to main content

GetElementByName method (NotesJSONNavigator – LotusScript)

Retrieves a NotesJSONElement by name.

Defined in

NotesJSONNavigator

Syntax

Set el = jsnav.GetElementByName(``name``)

Parameters

name

String. The name of the element to retrieve.

[SuppressErrors]Boolean. Optional. If True, suppress “JSON Element not found error” and return Null element when element not found.Note: This parameter is new with release 14.5.1.

Return value

Returns NotesJSONElement that matches the name parameter.

If the JSONElement is not found and not using SuppressError = True, the following error is thrown: 4843 - JSON Element not found.

Example

Sub Initialize
On Error GoTo Handle
Dim session As New NotesSession
Dim jsnav As NotesJSONNavigator
Dim el As NotesJSONElement

Set jsnav = session.CreateJSONNavigator(|{"test":"A string"}|)
Set el = jsnav.GetElementByName("test")

Set el = jsnav.Getelementbyname("test1", True) 'Do not raise error continue work with next line

If el is Nothing Then
MessageBox("JSON element not found")
End If

Set el = jsnav.Getelementbyname("test1") 'Will raise error JSON Element not found

Exit sub
Handle:
MsgBox "Error is " & Error() & " On Line " & CStr(Erl())
Exit sub
End Sub