Question about dropdowns


Is there any way in the ignition designer where we can choose the value from the dropdown menu and according to the input we select and submit it opens the window like these as you can see in Input Job Work where we have many other input labels where we need to fill the input so that it can be shown on the screen and also able to store in a database like MYSQL?
Please explain the procedure in step-by-step form and also explain the way of coding we need to do.

Thanking you

Have you completed the relevant sections of training on Inductive Universtiy?

Yes

1 Like

What does your question have to do with page back and forward navigation???

2 Likes

I just want to know that after selecting batch no out of many options and clicking the submit button it opens the square box as you can see just below the input job work and whatever the value we enter over there it get store in a database

That's either a popup or a container that you display only when needed. You trigger the popup/container visibility based on the dropdown's value or through its events.
If you need more help than that, I suggest you try to formulate what exactly your issue is. As it is now, it just looks like you're too lazy to do your job and you're asking us to do it for you.

no brother I have done a lot I just want to make my work functional rather than that I have already made the database connectivity and also fill the value on it ..the only issue is that i am not able to write the proper scripting


again:

And "the only issue is that i am not able to write the proper scripting" is not a proper question.

I'd also suggest that "TTT" is really not a good name for your table.

1 Like

okay, can you give me suggestions on how I can learn to resolve my issue. I am new to ignition and i have just to do this things

Again, I don't know what your issue is, so how can I help you resolve it ?

As it's been said before: Go through the Inductive University. Then try to do your thing, which will involve, as suggested before, open a popup or toggling the visibility of a container.

And if you run into problems trying to do that, tell us exactly what the problem is.

Okay sir ..

Thank you so much

Going back to your OP, I think I understand what you want.

You want to select a Batch No, press "Submit" (strange terminology), which then opens a popup or fills in another section of the page, based on a query on a database table using the batch no in the where clause.

You want to be able to update the fields pulled from the database and save them back to the database table.

Is that right?

If so, the basic steps are (assuming the batch no dropdown is already displaying the options):

  1. select batch no from the dropdown. (I would be bidirectionally binding this to a view.custom prop so make it easily bindable, without possibility of it being broken by restructuring of components)
  2. create another view.custom prop with a query binding to look up the batch no you selected in your table. this should not be set to update periodically
  3. bidirectionally bind each of the fields returned from the query to input fields in your form. The user can edit these
  4. In your "accept changes" or whatever button, it would grab the batch no and all of the values from (2) prop and then call an UPDATE query to update the record in the table filtered to the batch no

e.g.

batchNo =  self.view.custom.selectedBatchNo
machineNo = self.view.custom.batchNoDetails.machineNo
itemName = ...
...
batchEndDate = ...

query = '''
UPDATE table
SET machineNo = ?, itemName = ?, ..., batchEndDate = ?
WHERE batchNo = ?
'''
system.db.runPrepUpdate(query, [machineNo, itemName, ..., batchEndDate, batchNo])

Note: the query's question marks are not placeholders for you to replace with something else; these are essential. They are replaced automatically by the args you pass into the runPrepUpdate's args

You probably also want some error handling and to alert the user if an error occurs. You'll need to check both Python exception as well as Java exceptions:

from java.lang import Throwable
try:
   ...code
except Throwable as e:
   system.perspective.openPopup(....)
except Exception as e:
   system.perspective.openPopup(....)
2 Likes

Thank you so much @nminchin Sir now I can able to resolve my problem if
If I anyhow encounter a problem I will reach out to you.
Thank you so much