Loading Accordion Widget from SQL Data

Use this board to ask questions or have discussions with other Profound.js users.
Bernie
New User
Posts: 10
Joined: Mon Nov 04, 2019 11:01 am
First Name: Bernard
Last Name: Harris
Company Name: Weather Shield Mfg., Inc.
Phone: 7157482100
Address 1: One Weather Shield Plaza
City: MEDFORD
State / Province: Wisconsin
Zip / Postal Code: 54451
Country: United States
Contact:

Loading Accordion Widget from SQL Data

Post by Bernie »

Hello, How can I load the Accordion Widget from a SQL statement? I want to load a listing of the applications available based on what the user is authorized to.
User avatar
matt.denninghoff
Profound Logic Staff Member
Posts: 115
Joined: Wed Feb 10, 2016 3:53 pm
First Name: Matthew
Last Name: Denninghoff
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: Loading Accordion Widget from SQL Data

Post by matt.denninghoff »

The Accordion Layout is not designed to show any data itself, other than the section names. Section names can be "bound" to a field. Read here for binding in Designer: https://docs.profoundlogic.com/display/ ... ing+Dialog

So, if you use an SQL statement to populate a variable in your program with comma-separated values, you can assign that value to the bound field. Then when you call pjs.display(), Profound.js will use the assigned value:
https://docs.profoundlogic.com/pages/vi ... d=31752762
Bernie
New User
Posts: 10
Joined: Mon Nov 04, 2019 11:01 am
First Name: Bernard
Last Name: Harris
Company Name: Weather Shield Mfg., Inc.
Phone: 7157482100
Address 1: One Weather Shield Plaza
City: MEDFORD
State / Province: Wisconsin
Zip / Postal Code: 54451
Country: United States
Contact:

Re: Loading Accordion Widget from SQL Data

Post by Bernie »

So I can't set the section names at the time the screen is being loaded? I tried to assign names to the sections and then set them in the javascript but nothing happens. What other widget would be good for this if the Accordion can't be modified while displaying it?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Loading Accordion Widget from SQL Data

Post by Scott Klement »

You want to load a list of applications that the user is authorized to and make them section names? Sorry, that doesn't make any sense to me...
Bernie
New User
Posts: 10
Joined: Mon Nov 04, 2019 11:01 am
First Name: Bernard
Last Name: Harris
Company Name: Weather Shield Mfg., Inc.
Phone: 7157482100
Address 1: One Weather Shield Plaza
City: MEDFORD
State / Province: Wisconsin
Zip / Postal Code: 54451
Country: United States
Contact:

Re: Loading Accordion Widget from SQL Data

Post by Bernie »

I need to provide some method for the users to view all of their apps available and then get to each one of them, similar to a menu system on the IBM i.
User avatar
matt.denninghoff
Profound Logic Staff Member
Posts: 115
Joined: Wed Feb 10, 2016 3:53 pm
First Name: Matthew
Last Name: Denninghoff
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: Loading Accordion Widget from SQL Data

Post by matt.denninghoff »

It is certainly possible to setup the section names for the screen and then display the screen along with those section names. Like Scott indicated, there are better widgets for doing what you described--menu widget or select box. The data in those widgets can be populated with SQL statements without needing to code the SQL in the application and binding first.

You said, "So I can't set the section names at the time the screen is being loaded?" It is possible to set section names immediately before displaying the screen (via pjs.display) by setting a bound field. It is not possible to set the section names after the screen has loaded. Are you saying you're trying to set them with JavaScript in the Designer or via your Profound.js (Node.js) application?

Perhaps if you showed what code and display file you tried it would help.
Bernie
New User
Posts: 10
Joined: Mon Nov 04, 2019 11:01 am
First Name: Bernard
Last Name: Harris
Company Name: Weather Shield Mfg., Inc.
Phone: 7157482100
Address 1: One Weather Shield Plaza
City: MEDFORD
State / Province: Wisconsin
Zip / Postal Code: 54451
Country: United States
Contact:

Re: Loading Accordion Widget from SQL Data

Post by Bernie »

Okay, so I would be better of to use the menu widget to provide what I'm looking for? Do you have a sample of loading this from SQL?

What I was trying to do with the Accordion widget was create an expandable menu where I could setup the sections based on what the users were authorized to and then what was available in each section would be the applications or the subsets of applications that is available to the user. I don't have much for a screen or code because I was at the beginning trying to set up the widget to get it to work. And I was trying to set this within node.js because it would be where the SQL would be executed upon initial load up of the main menu application.
User avatar
matt.denninghoff
Profound Logic Staff Member
Posts: 115
Joined: Wed Feb 10, 2016 3:53 pm
First Name: Matthew
Last Name: Denninghoff
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: Loading Accordion Widget from SQL Data

Post by matt.denninghoff »

You cannot use the Accordion Layout widget for what you're describing. The menu is closer to what you want. I would use SQL in the Profound.js application to create a comma-separated list of program names. See here for PJS query:
https://docs.profoundlogic.com/pages/vi ... d=37028376

You might need to reference this for how to pass the variable to the display:
https://docs.profoundlogic.com/pages/vi ... d=31753041

Binding the "menu response" property causes the menu to send data back to your Profound.js application when the user clicks on an option. You can search for "bind" or "binding" in our documentation for more information on binding, or read starting here:
https://docs.profoundlogic.com/display/ ... Properties
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests