How to sync different table structure in SymmetricDS? - symmetricds

How to synchronize different table structure in SymmetricDS?
Let say, I want to sync this tables:
(Server Node) Student | Id, Name
(Branch Node) Person | Id, Name, Birth Date
Thank you.

You can use an implied transform and set the source table to Student and the target table to Person. The Id and Name columns will automatically transfer. You could add a column transform as a child to this table transform to include a Birth Date with no source column. Im not sure where you get the birth date but there are other column transform types such as lookup etc that might help.

Related

Get latest date in a column based on a duplicate value in a table using Powerautomate

I have a table in dataverse, that has a date, telephone number, and ID columns as below.
Date
ID
Telnum
12/6/202
abcd
8421678
12/9/2020
abce
8421679
12/13/2020
abcg
8421678
From the table the 1st and 3rd column have the same Tel num, but different dates and ID. What am trying to achieve is on the same table in a column called end date,post the last date with regards to the tel num this is basically the 1st date of the date the number switched to a new record based on ID.
The table am trying to come up with looks as below
Date
ID
Telnum
Date To
12/6/202
abcd
8421678
12/13/2020
12/9/2020
abce
8421679
12/13/2020
abcg
8421678
What I've tried is create an Instant flow, List Records(The table name), List records 2 (Table name but this tome with filters {The filters are (tel num eq tel num and id ne id)}, Then Update record to populate the end date.
What am missing is a step to get the max or latest date of the column that I will append to the date to mapping.
Any idea on how to achieve this will be highly appreciated.
TIA.
According to the description of your requirement, it seems you want to add one more column(named Date To) for the table and set the current date(you mentioned as max or latest date) as the value of the new column.
The second table you provide shows the value of DateTo should be like 12/13/2020, but if you just set the date with the format month/day/year, it can't help you distinguish the two records which has same Telnum because they are both 12/13/2020. So you should set the value of DateTo with format of 2020-12-21T07:23:34.5951356Z. To implement it, you can use utcNow() method shown like below screenshot.
If I misunderstand your requirement, please let me know and provide more details about your question.

Laravel: Create tables with variable in name

How can i create and migrate lots of tables in laravel with a variable in their name?
I need to create a table "time-{{user_id}}" every time a new user is added to a table called "users".
How can i realize this and how does the Migrationfile/Controller/whatever has to look like?
Thanks!
"Now i need a table for each user where i can store something like a CV.. Date begin, date end, City etc"
Sounds like you need another table with a 1:1 relationship to the users table
Your new table will look something like
tblFurtherUserInfo
FurtherUserInfoId
CV
DateBegin
DateEnd
City
You should add a new row to this table and set FurtherUserInfoID to be the same as the userID in your user table. You should do this whenever you add a record to your user table
EDIT
Now I know a user can have more than one CV, you need a new table as follows
tblCV
CVId
UserId
CV
DateBegin
DateEnd
City
This is a 1 user : many CVs relationship

Creating a global ID for every row in multiple tables for notifications

I'm designing what is essentially an accounting/retailing application for MS SQL Server 2016. I have ~75 core data object types, each in their own respective table (users, organizations, invoices, payments, etc.).
What I need to create is a notification system,
e.g. "Steve paid invoice 1234", "Bob purchased product XYZ", etc. What I was going to create was a "notification types" table:
NotificationTypes:
id message
11 "{0} paid invoice {1]"
12 "{0} purchased product {1]"
...
and then have two corresponding tables that store each notification event's info, and then the values for that notification message. So for example for "Steve paid invoice 1234":
NotificationEvent:
id notificationType (FK) occured
21 11 2016-01-01 00:00:00
NotificationEventValues:
id notificationEvent (FK) XXXXX
31 21 (FK reference to Steve in users table)
32 21 (FK reference to invoice 1234 in invoices table)
Now since I can't create generic foreign keys for NotificationEventValues.XXXXX, I was going to have a single 'dataObjects' table that has FK columns for all 75 data types I have, with only one of the 'data type' columns having a value per row.
This way, every instance of a data object in my database has a unique ID I can reference in the notification field - which will mean a huge table given it has a unique ID for basically every row in the other 75 tables. The other downside is it means for every user, invoice, any 'data object', I'm wasting significant amounts of space since space will be reserved for ID references for the other 74 null-valued columns (since they're fixed size IDs and not variable).
ASK:
Is there a better way to achieve my 'global' identifier across all the tables? Or a better way to handle the notification system to avoid this problem?
Create triggers in all table that will insert a record in a table say KeyMaster with one column key which will also be the primry key whenever a record is inserted in any table. The value inserted in this table will be in the format _. For example if a record is inserted in user table with id 1 then the record inserted in KeyMaster table will be 'user_1'. Similarly if a record is inserted in invoice table with id 1 then the recor inserted in KeyMaster table will be 'invoice_1'.
In your NotificationEventValues table you will need only three columns id,notificationEvent and key (FK reference to KeyMaster table).
For getting corresponding record you need to write query similar to below:
select *
from NotificationEventValues n
inner join users u on 'user_' + u.id = n.key

Database schema for end user report designer

I'm trying to implement a feature whereby, apart from all the reports that I have in my system, I will allow the end user to create simple reports. (not overly complex reports that involves slicing and dicing across multiple tables with lots of logic)
The user will be able to:
1) Select a base table from a list of allowable tables (e.g., Customers)
2) Select multiple sub tables (e.g., Address table, with AddressId as the field to link Customers to Address)
3) Select the fields from the tables
4) Have basic sorting
Here's the database schema I have current, and I'm quite certain it's far from perfect, so I'm wondering what else I can improve on
AllowableTables table
This table will contain the list of tables that the user can create their custom reports against.
Id Table
----------------------------------
1 Customers
2 Address
3 Orders
4 Products
ReportTemplates table
Id Name MainTable
------------------------------------------------------------------
1 Customer Report #2 Customers
2 Customer Report #3 Customers
ReportTemplateSettings table
Id TemplateId TableName FieldName ColumnHeader ColumnWidth Sequence
-------------------------------------------------------------------------------
1 1 Customer Id Customer S/N 100 1
2 1 Customer Name Full Name 100 2
3 1 Address Address1 Address 1 100 3
I know this isn't complete, but this is what I've come up with so far. Does anyone have any links to a reference design, or have any inputs as to how I can improve this?
This needs a lot of work even though it’s relatively simple task. Here are several other columns you might want to include as well as some other details to take care of.
Store table name along with schema name or store schema name in additional column, add column for sorting and sort order
Create additional table to store child tables that will be used in the report (report id, schema name, table name, column in child table used to join tables, column in parent table used to join tables, join operator (may not be needed if it always =)
Create additional table that will store column names (report id, schema name, table name, column name, display as)
There are probably several more things that will come up after you complete this but hopefully this will get you in the right direction.

Storing multiple employee IDs in one column of data

Web app is being written in classic ASP with a MSSQL backend. On this particular page, the admin can select 1 or any/all of the employees to assign the project to. I'm trying to figure out a simple way to store the employee IDs of the people assigned to it in one column.
The list of employees is generated from another table and can be dynamic (firing or hiring) so I want the program to be flexible enough to change based on these table changes.
Basically need to know how to assign multiple people to a project that can later be called up on a differen page or from a different query.
Sorry for the n00bish question, but thanks!
Don't store multiple ID's in one column! Create another table with the primary key of your existing table and a single ID that you want to store. You can then insert multiple rows into this new table, creating a 1:m (one to many) relationship. For example, let's look at an order table:
order:
order_id
order_date
and I have a product table...
product:
product_id
product_name
Now, you could go down the road of adding a column to order that let you list the products in the order, but that would be bad form. What you want instead is something like..
order_item:
order_item_id
order_id
product_id
quantity
unit_price
You can then perform a join to get all of the products for a particular order...
select
product.*
from orders
inner join order_item on order_item.order_id = order.order_id
inner join product on product.product_id = order_item.product_id
where orders.order_id = 5
Here's an example order_id of 5, and this will get all of the products in that order.
You need to create another table that stores these values such as. So this new table would store one row for each ID, and then link back to the original record with the original records ID.

Resources