Is it possible to create different forms for the same table?

110 views
Skip to first unread message

Enrico Mattioni

unread,
Aug 13, 2022, 4:24:19 AM8/13/22
to Jam.py Users Mailing List
Hi,
I am new to jam.py and find it really interesting and practical.
However, I cannot solve a problem.
I have a main table (MasterProcesses) and a detail table (ProcessData).
I would like to manage the editing of MasterProcesses and ProcessData in two separate forms, within different tabs.
I would like to create a form for editing the data of the main table without details (Form1) and another form that displays the data of MasterProcesses in read-only mode and allows editing the details (Form2).
I have no problem creating the two forms separately, but I would like them to coexist on different tabs.
In a first attempt, I tried handling the situation from the on_view_form_created(item) function of MasterProcesses, checking which tab was open,  but I was unsuccessful.  The application has unexpected behaviour, probably because duplicate classes are always created referring to AnagraficaProcessi.
In a second attempt, I tried to create an empty virtual table, to insert Form2 inside, passing through the on_view_form_created(item) function of the virtual table, but again I was unsuccessful.
Can anyone help me?
Thank you very much.
Enrico


Fabio Lenzarini

unread,
Aug 13, 2022, 9:45:41 AM8/13/22
to Jam.py Users Mailing List
Hi Enrico

As far as I know, you should create a "dummy" table with the structure you need and then, when you open it, populate the records.

I modified the "builder" and added the ability to create "views."
view_2.png

This way you can have as many view forms as you want.

view_3.png
Of course, if you have to perform CUD operations (create, update and delete) you have to work on the "real" tables.
Alternatively, you can create a dummy table and, from code, create the grid with the fields you want with "create_table" 


ciao
Fabio

Drazen D. Babic

unread,
Aug 13, 2022, 1:51:28 PM8/13/22
to Jam.py Users Mailing List
Hi,

if I read this well: I would like to create a form for editing the data of the main table without details (Form1) and another form that displays the data of MasterProcesses in read-only mode and allows editing the details (Form2).

this are the Customers details (Form1), and Tracks (Form2) as Master-Detail in where you edit only Tracks and Customers can be r/o. So not quite sure where the problem is.
This is what Demo sort of does. It is a slightly different approach tho, but here you have something called AnagraficaProcessi in the mix, so not sure what that is....
Also, not quite sure what the tab is, because normally the tables are in the Menu, not on tabs. Are you referring to tabs on the Form?
The tabs instead of Menu will show only if there are no more than one single Item Group.
Have a look how many Items exist on Fabio's App:

Maybe Andrew has some better advice tho.

D.


Enrico Mattioni

unread,
Aug 14, 2022, 5:03:15 AM8/14/22
to Jam.py Users Mailing List

Thank you Fabio and Drazen for your prompt reply.

I apologise to Drazen because in my request I had not realised that I had called the same table by two different names: MasterProcess is the English translation of AnagraficaProcessi (and ProcessData is the translation of DatiProcessi, a table with the details of MasterProcess).

 I also clarify that when I speak of tabs, I am referring to the tabs created by the program in the form.

Senza titolo.png

(in the picture ProcessiDati is the tab I tried to create with the virtual table ProcessiDati, a table different from the details table DatiProcessi).

Fabio, your solution is interesting, but if I understand correctly it is not included in the "default" version of jam.py (I am using version 5.4.122). I tried to see on Github if there was any fork, but without success. Where could I find it?

Drazen, I tried to see the example https://sem.pythonanywhere.com/, but the builder doesn't show me anything. Before writing, I also looked for the solution on the Demo, but I hadn't found anything. I probably didn't look carefully enough. 

Over the next few days I will make a few more attempts and if I solve my problem I will post the solution for the benefit of all, otherwise I will ask for help again, better clarifying the problem.

For now, thank you both very much and have a happy August holiday.

Enrico

Danijel Kaurin

unread,
Aug 14, 2022, 5:14:25 AM8/14/22
to Enrico Mattioni, Jam.py Users Mailing List
Hi Enrico.

Can you try to draw a design wich you want to achieve?

Regards

Danijel Kaurin

--
You received this message because you are subscribed to the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jam-py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jam-py/2cbf0592-47a1-4f8f-94db-c5d17f3e63ffn%40googlegroups.com.

Drazen Babic

unread,
Aug 14, 2022, 7:42:31 AM8/14/22
to Jam.py Users Mailing List
No worries at all

I think SEM demo can be found here, Fabio shared the file which I put on PAnywhere. It is not  the solution for your issue though.

Views are not on Git yet.

Lets see what Andrew might advice.

D.

--
You received this message because you are subscribed to a topic in the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jam-py/zs7d48xYWks/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jam-py+un...@googlegroups.com.

Drazen D. Babic

unread,
Aug 17, 2022, 9:51:22 AM8/17/22
to Jam.py Users Mailing List
Hi all,

I completely forgotten, in v7 you can have multiple forms of the same table!
Here is how it looks like after I finished copying and no modification of the view:
Capture1.PNG

Capture2.PNG

Fabio Lenzarini

unread,
Aug 17, 2022, 10:35:29 AM8/17/22
to Drazen D. Babic, Jam.py Users Mailing List
Hi Drazen,
Where's the version 7?
On git i see 5 and develop (6).
Thanks

Ciao
Fabio 

--
You received this message because you are subscribed to a topic in the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jam-py/zs7d48xYWks/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jam-py+un...@googlegroups.com.

Drazen D. Babic

unread,
Aug 17, 2022, 10:47:24 AM8/17/22
to Jam.py Users Mailing List
Hi Fabio,
I think it is just marked as 6, do:
git clone --branch develop https://github.com/jam-py/jam-py/
or donwload zip.
D.
Reply all
Reply to author
Forward
0 new messages