iModernize - The Profound Logic Software Blog

Tips And Tricks: Populate Dropdown Options from a Universal Display File Program

Posted by DRusso on Sep 2, 2014 6:16:02 AM

One of the most exciting features of Profound UI 5.0 is the Universal Display File Editor and Handler. Universal Display Files are a dead simple way to produce web output from an RPG program.

One example of where this might be useful to Profound UI users populating records for Rich Display File components such as dropdowns, auto-complete boxes, grids, etc. These widgets have properties that can be used to have Profound UI fetch the records automatically, but it's often required to incorporate custom programming logic. In the past, this has required writing a custom CGI or PHP script to implement. Universal Display Files provide a much easier alternative.

For example, let's look at populating dropdown box options from a custom program. In Profound UI, the dropdown box has a 'choices url' property that can be used to invoke a web program to produce the options.

ss1

The documentation for a dropdown box shows how the web program should respond:

http://www.profoundlogic.com/docs/display/PUI/Select+Box

So, this has always been possible, but up to this point it has required knowledge of web programming in general, and some specific web technology, such as CGI or PHP. Now, we can create such a program very easily using Universal Display Files.

See the Universal Display File documentation here:

http://www.profoundlogic.com/docs/display/PUI/Universal+Display+Files

The attached example Universal Display File DDS member "DROPDOWND" and RPG program "DROPDOWNR" create a set of dropdown options using the PRODP file in the PUISAMPLES library.

You can download the example code by right-clicking on the links below and selecting "Save Target As".

dropdownd_dds

dropdownr_rpgle

If a URL mapping "/dropdown" is created for this program, then the "choices url" property of a dropdown box can be set to "/profoundui/universal/dropdown" to invoke the program and produce the options.

The program will run as the same user, and with the same library list as the Profound UI / Genie session, so make sure the library of the Universal Display file and also the PUISAMPLES library are on the library list when using this example.

Topics: Tips and Tricks, New Features

Subscribe to Blog Updates

....and get The 2017 State of IBM i Modernization White Paper FREE!

cover page.png

Recent Posts