Searching JSON Data
After you have created some applications that use Profound UI Rich Display Files, you will want to be able to search them. For example, if you need to increase the size of the CUSTADDR field, you might want to locate all display files that have widgets bound to that field, so you can increase the size and re-test the programs. Or perhaps you've used a particular JavaScript API, such as pui.normalizeURL() and would like to find all applications that use that API. All of the widgets and properties that you code in Rich Display files are stored in JSON data that's embedded with HTML keywords in your DDS source code.
Profound UI provides a command named PUIFNDSTR that you can use to search that DDS source code. The details of this command follow:
Find String in PUI DDS Source (PUIFNDSTR)
The Find String in PUI DDS Source (PUIFNDSTR) command lets you search for character strings in the Profound UI metadata stored in DDS source code. You can use it to determine which widgets contain a given string or are bound to a particular DDS field.
Parameters
Keyword | Description | Choices | Notes |
---|---|---|---|
STRING | Find 'string' | Character value, *ALL | Required |
PROPERTY | Property to search | Character value, *ALL | Required |
SUBPROP | Sub-property to search | Character value, *NONE, *ALL | Optional |
SRCFILE | Source file | Qualified object name | Optional |
Qualifier 1: Source file | Name, QDDSSRC | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
SRCMBR | Source member | Name, *ALL | Optional |
BNDONLY | Bound field names only | *YES, *NO | Optional |
MATCHCASE | Search is case-sensitive | *YES, *NO | Optional |
OUTPUT | Output | *, *OUTFILE | Optional |
OUTFILE | File to receive output | Qualified object name | Optional |
Qualifier 1: File to receive output | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
OUTMBR | Output member options: | Element list | Optional |
Element 1: Member to receive output | Name, *FIRST | ||
Element 2: Replace or add records | *REPLACE, *ADD |
Find 'string' (STRING)
Specifies the string you want to search for.
This is a required parameter.
*ALL
Return all properties, no matter what the values are set to.
character-value
Specify the string to search for.
When the bound only (BNDONLY) parameter specifies *NO, any widget property that contains this string will be returned.
When the bound only (BNDONLY) parameter specifies *YES, only bound variables that exactly match this string will be returned.
Property to search (PROPERTY)
Specifies widget property name that will be searched.
This is a required parameter.
*ALL
Search all widget properties.
character-value
Only widget properties that contain the specified string will be searched. For example, if you specify 'border' for this string, all widget property names that contain the word 'border' will be searched.
Sub-property to search (SUBPROP) 1
Specifies widget sub-property name that will be searched. Some widget properties (such as "value") contain sub-properties such as "zeroBalance" (as shown on the Binding dialog) or "translations" (as shown on the "Translation Settings" dialog). The sub-property name as stored in the JSON metadata may be slightly different than what is shown on the dialogs. For example, "Show Zero Balance" on the Binding dialog is stored in the metadata as "zeroBalance". To view the actual sub-property names, you can perform the following steps in the Profound UI Visual Designer:
Open the Rich Display File, which will be initially displayed in Design View. Click "Edit" on the ribbon to select the Edit tab.
Under "View", click "Source" to switch to Source View. The JSON metadata for all widgets are displayed.
Right click on the source and click "Format Document" to view the metadata in a more readable format.
Press Ctrl-F to search for a particular widget and view its properties and sub-properties.
Example: Command "PUIFNDSTR STRING(12345) PROPERTY(*ALL) SUBPROP(translations)" will find all instances where the sub-property "translations" contains string "12345", regardless of what property the sub-property "translations" belongs to. Command "PUIFNDSTR STRING(12345) PROPERTY("column headings") SUBPROP(translations)" will find all instances where the sub-property "translations" of property "column headings" contains string "12345".
*NONE
No sub-property will be searched.
*ALL
Search all widget sub-properties of the property specified in the PROPERTY parameter.
character-value
Only widget sub-properties that contain the specified string will be searched. For example, if you specify 'translations' for this string, all widget sub-property names that contain the word 'translations' will be searched.
1(available in Profound UI Version 6, Fix Pack 7.0)
Source file (SRCFILE)
Specifies the file that contains the members that you want to search. This file should be a source physical file that contains DDS source code.
Qualifier 1: Source file
QDDSSRC
The source file named QDDSSRC contains the DDS source code that is to be searched.
name
Specify the name of a source physical file that contains DDS code to be searched.
Qualifier 2: Library
*LIBL
The library list will be searched to find the file. Only the first file found will be searched.
*CURLIB
The current library of the job will be used to locate the file to be searched.
name
Specify the name of a library that contains the source file to be searched.
Source member (SRCMBR)
Specifies the name of the member to be searched.
*ALL
Search all members in the source physical file.
name
Specify the name of a member in the source physical file to search.
Bound field names only (BNDONLY)
Specifies whether to limit the search to bound field names. Bound field names are DDS fields that have been connected to widgets in your display file.
*YES
Only search bound field names. When *YES is specified, the STRING parameter will be interpreted as a field name to search for. The search will output all widgets that have the given field name bound to them. There will be one output record for each place that the bound field is used.When BNDONLY(*YES) is specified, the STRING parameter must match the field name exactly.
*NO
Search for strings in both bound and un-bound properties. Any property that contains the STRING parameter (either an exact match, or when STRING is a substring of the widget property) will be returned.
Search is case-sensitive (MATCHCASE)
Specifies whether the search is case-sensitive.
*YES
The search will only match if the upper/lower case letters in the source code match the upper/lower case letters in the STRING and PROPERTY parameters exactly.
*NO
The search will match any string found, regardless of upper/lower case letters. This is the default.
Output (OUTPUT)
Specifies where the output from the command is sent.
*
The output from the command is sent to the user's interactive terminal.
*OUTFILE
The output from the command is directed to the database file specified for the File to receive output (OUTFILE) parameter.
File to receive output (OUTFILE)
Specifies the database file that search output will be directed to if *OUTFILE is specified in the OUTPUT parameter. The format of this file must patch that of the FNDSTRP physical file provided with the Profound UI product.
Qualifier 1: File to receive output
name
Specify the name of the database file to receive output.
Qualifier 2: Library
*LIBL
The library list is searched to locate the database file to receive the output. You may only specify *LIBL for files that already exist on disk. When creating a new file, please specify a library name or *CURLIB.
*CURLIB
The job's current library is used to locate or create the database file to receive the output.
name
Specify the name of a database file to receive the output. If this file does not exist, the PUIFNDSTR utility will create it.
Output member options: (OUTMBR)
Specifies the member in which search output will be placed.
Element 1: Member to receive output
*FIRST
Use the first member in the physical file. If no members exist the PUIFNDSTR utility will a new one with the same name as the output file name.
name
Specify the name of the member that should receive the search output. This member will be created if it does not exist.
Element 2: Replace or add records
*REPLACE
If the member exists, replace it's contents with the output of the current search.
*ADD
If the member exists, new records returned by the current search will be added to the end of the member.
Examples for PUIFNDSTR
Example 1: Simple Command Example
PUIFNDSTR STRING('js:') PROPERTY(*ALL) SRCFILE(SOURCE/QDDSSRC)
This command will search all properties of all widgets for 'js:'. The output will appear on the interactive display.
Example 2: Searching for a bound field
PUIFNDSTR STRING(CUSTNO) PROPERTY(*ALL) BNDONLY(*YES)
This command will search all properties of all widgets and return all properties that have been bound to the CUSTNO field.
Error messages for PUIFNDSTR
*ESCAPE Messages | |
---|---|
CPF9801 | Object &2 in library &3 not found. |
CPF9802 | Not authorized to object &2 in &3. |
CPF9810 | Library &1 not found. |
CPF9812 | File &1 in library &2 not found. |
CPF9820 | Not authorized to use library &1. |
PUI0041 | &1 errors detected during search. |
Some documentation pages have recently moved to a new section: Profound AppDev. If you are having trouble finding specific pages, try the documentation search capability or reach out to our Support team!