How to create a new 1-n relationship as a tab in the tabs of the product window?

How can I create a new 1-n relationship with associated database table as a tab in the tabs of the product window?


Best regards

hi Matze,

you need to create a new table in java backend and then create a correspondent tab which you link using the field “link column”.

cheers,
Norbert

Hi Norbert, can you please give me the information if I can do this by database configuration, or must I write specific Java code to make this possible?
Best Regards
Matthias

hi Matze,

first you need to get java client going that allows customizing via backend:
https://docs.metasfresh.org/installation_collection/EN/How_do_I_use_Java_Client_using_Docker.html

cheers,
norbert

Hello Norbert, thank you, i will try it with the java swing client, but how can I reproduce the database statements for such a customization, is there any solution to do this? I can perhaps call you by telephon regarding this?

Best regards
Matthias

I don’t know if I understood the question very well, sorry for the English.

The first step would be to create the table that you want to associate with the main one in the case of the product, it must have a relationship with the m_product

CREATE SEQUENCE name_table_seq INCREMENT 1 START 1;
create table name_table
(
ad_client_id numeric(10) default 0 not null,
ad_org_id numeric(10) not null,
isactive char default ‘Y’::bpchar not null constraint name_table_isactive_check check (isactive = ANY (ARRAY [‘Y’::bpchar, ‘N’::bpchar])),
created timestamp with time zone default now() not null,
createdby numeric(10) not null,
updated timestamp with time zone default now() not null,
updatedby numeric(10) not null,
name_table_id numeric(10) default nextval(‘name_table_seq’::regclass) not null constraint name_table_pkey primary key,
m_product_id numeric(10) not null constraint mproduct_name_table references m_product on delete cascade deferrable initially deferred
);
alter table name_table owner to metasfresh;

Keep in mind that every table that is created must have these fields required (ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby),
metasfresh uses those fields to save them automatically.

Attached document with more information about the process, I hope it will help you.

https://drive.google.com/file/d/1hcNEHNcZd1URu2Y61SX0SRp7RsdKOvH5/view?usp=sharing

Hello David,

thank you very much, i will try it based on your instructions!
Regarding this, i have a second question, how can I record the SQL-Statements which are executed by the execution in the java client GUI to reproduce the adjustments?
At the moment i am using the sql-logs of the postgres DB in the docker image after setting a higher log level?

Best regards
Matze

Sorry, I have not used the Docker version.
But I believe that by creating a virtual unit where to store the database, when a container is installed or modified, all the changes made to the database would remain persistent.

it would be something like this but applied to the type of file that is being used to upload the metafresh container that you are using.