How to build a Dynamic Page

Let’s say we have some filter options at the top of a page, that I already know how to create. Based on the criteria of the filters I want to return a line item for each record meeting that criteria. I want to be able to have buttons and other record related info printed within each line.

ex:
For each record, print a new line with button to toggle Boolean Value record item, dropdown list to edit text value item, edit button that will allow edit of other items for this one record.

How to I code this? Will I have to use Java or Jython?
I would be thankful if anyone can post some different examples of how to do this.

Figure out the maximum number of items you want on a “page”, and create default elements for them. Using scripting, you can then toggle the visibility of unused controls, and move the visable ones on their y axis to fit in a nice column.

code would look something like

# keep track of the top position
top =  0

# iterate through all the "elements"
for x in range(20)
    element = event.parent.getComponent("element_%02d" % x)
    element.visible = app.yourscript.checkVisable(x) # this is some script for your business logic

    # reapply a new layout
    if element.visable:
        top = top + element.getHeight() + 2
        pos_x = element.getX()
        element.setLocation(pos_x, top)

        # change any sub components for that element here

    window.revalidate()

This is great info, but I am still missing a lot. Can you give me an example of how to implement this?

Let’s say i have a tableA with four fields each record [ Id (PK, int, auto increment),Text1(varchar(50), Text2(varchar(50), Text3(varchar(50) Bool1(bit)]

Can you show me an example that will print 10 records on a page at once, with each line showing The Id, Text1, Text2, Bool1 and a button to toggle bool1, and a button to allow an edit for Text1 and Text2?

Or something with similar functionality of the image attached.


Ok, this is even easier.

You just need to setup the table source to use the parameters in the controls. You do some scripting on the table events for the validation events that do update queries to your database depending on what row/column the event came from.

I am sure it will be easy to expand on once seeing a basic example. I know there are a lot of swing packages that will help as well. I just don’t know how to set this up inside the ignition windows.

Will someone please give me a windowexport with a small example of how to get this kind of thing started?

jython.org/jythonbook/en/1.0 … tions.html
docs.oracle.com/javase/1.5.0/doc … mmary.html

When working with the Windows I see the code below will allow you to change characterisics of existing items like this HeaderLabel. But how can I dynamically create my own components in a window?

try:
   window = system.gui.getWindow("Overview")
   label = window.rootContainer.getComponent("HeaderLabel")
   label.text = "Notice Me!"
   label.foreground = (255,0,0)
except ValueError:
   # ignore error with a pass keyword
   pass

Is this where I would use a Paintable canvas?

inductiveautomation.com/supp … canvas.htm

inductiveautomation.com/supp … _types.htm

Bump… :prayer:

Sorry, ecujak, came off of a 20 hour work day, and switch to second shift for a bit-- my sleep pattern’s all all jacked up at the moment.

I had started on an example, but haven’t had much time to work on it. I hate it when work gets in the way! :laughing:

JordanCClark, thanks for coming to my rescue again. I appreciated your help last time around.

Colby.Clegg, Travis.Cox, Carl.Gould, Robert.McKenzie, nathan, Kevin.Herron… someone please help.

One way to achieve this is by using the table component. Bind the data property of the table to a SQL query that returns a row for each item you want displayed. Once the data is displayed you can go into the table customizer to mark the columns you want the user to edit as editable. When editing, to get dropdown lists you just need to setup translation lists on the appropriate columns. When the user edits the cell it fires a cellEdited event on the table which you can respond to to run an update query to your database.

You may want to call our tech support to help you get started.

weve made some dynamic tables and easy charts that only load enabled or existing tags for or devices. They also check to see if alarming is enabled which allows setpoints to be displayed along with cell backgrounds highlighted on alarm conditions. Like Travis said, use the cell edited to fire off the update query. The tables are very powerful with the right person behind the keyboard!!!(not me most of the time!)

Ok, let me give the table component another go. I wouldn’t mind seeing some examples of formatting to make the table look and feel less like a table. Thanks for now. I am not the right person behind the keyboard for now, but hope to be soon. :unamused:

Okay, finally found some time…

All done with with no tables-- well there’s one at the bottom, but it’s just a monitor for the dataset so you can see the changes as they happen. :slight_smile:

The dataset has 26 entries so you can how it displays an uneven number of full pages.

Methinks that either an editable table or a table with a data entry popup would have been quicker. :laughing:
DataEntryWindow.vwin (64.2 KB)