Platform
Learn
Community
Support
Sign up
or
Log in
Profile
messages
Messages
logout
Logout
Platform
Home
Downloads
IPP
Licensing
Project Sizing
Beta
Learn
Training
Documentation
Evaluation Guide
Community
Jobs
Home
Forums
Forge
Ideas
Badges
Members
Support
Partner Guide
Resources Library
Opportunities
Account Management
Pre Sales Demos
Sign up
or
Log in
Home
Jobs
Forums
Forge
Ideas
Members
Badges
Dear ,
What would improve your OutSystems Community experience? Let us know by taking this 2-minute survey.
Pick up the survey
Community
›
Forums
›
Personal Environment Troubleshooting
Move entity from module to other one
New Post
New Post
freek
Posted on 2015-07-03
freek
Rank: #542
Posted on 2015-07-03
Hi There,
I have a module with a few entitys with a lot of data that I want to move to a core module. How can I do this and keep the values in the entitys. I dont want to create empty entitys in the new module.
Personal cloud running on OS9.
Greets.
Tiago Neves
Posted on 2015-07-04
Tiago Neves
Rank: #101
Posted on 2015-07-04
Solution
Hi freek,
On Personal cloud... hum... you cannot move (without losing data), but you can create copies.
One way to do that is to reference those entities in the new module and create an advanced query with some simple sql like
INSERT INTO table2
SELECT * FROM table1
Solution
freek
Posted on 2015-07-05
freek
Rank: #542
Posted on 2015-07-05
Solution
Hi Tiago,
When trying to do this I get the following error:
Database returned the following error: Error in advanced query SQL1: An explicit value for the identity column in table 'IPNV9R003.XXXXX' can only be specified when a column list is used and IDENTY_INSERT is on
Solution
Tiago Neves
Posted on 2015-07-05
Tiago Neves
Rank: #101
Posted on 2015-07-05
Solution
Hi,
It had been a while since I made something like that in OutSystems... You actually have to specify attributes and leave the Id attribute out.
Like this:
INSERT INTO {Table2}
( {Table2}.[Att2] ,{Table2}.[Att3] ,{Table2}.[Att4] ,{Table2}.[Att5] )
SELECT {Table1}.[Att2] ,{Table1}.[Att3] ,{Table1}.[Att4] ,{Table1}.[Att5]
FROM {Table1}
So, as you see, depending on the amount of attibutes and tables it can get annoying... :)
Solution
freek
Posted on 2015-07-05
freek
Rank: #542
Posted on 2015-07-05
Solution
Hi Tiago,
You will understand that this is a bad solution that will not working because there are other entitys depending on the Id. I will do a query on the old table add a extra Id (int) field on the new table import there the old id and use that to import the other entitys.
Solution
Tiago Neves
Posted on 2015-07-05
Tiago Neves
Rank: #101
Posted on 2015-07-05
Solution
Yep.
The problem is on the Personal Environment.
You could make SET IDENTITY_INSERT {Table2} ON and then back to OFF but this doesn't work on Personal Environment... And the order of the tables would also matter.
Solution
Tiago Neves
Posted on 2015-07-05
Tiago Neves
Rank: #101
Posted on 2015-07-05
Solution
If you can make it work on Personal Environment - user permissions I think - you could use the Id attribute and add IDENTITY_INSERT like this:
SET IDENTITY_INSERT {Table2} ON
INSERT INTO {Table2}
( {Table2}.[Id] ,{Table2}.[Att2] ,{Table2}.[Att3] ,{Table2}.[Att4] ,{Table2}.[Att5] )
SELECT {Table1}.[Id] ,{Table1}.[Att2] ,{Table1}.[Att3] ,{Table1}.[Att4] ,{Table1}.[Att5]
FROM {Table1}
SET IDENTITY_INSERT {Table2} OFF
Solution
Kilian Hekhuis
Posted on 2015-07-06
Kilian Hekhuis
Rank: #5
Posted on 2015-07-06
Solution
In addition to that, you may create a custom export/import of course, but that's a bit more work.
Solution
Rui Barbosa
Posted on 2015-07-06
Rui Barbosa
Rank: #42
Posted on 2015-07-06
Solution
Why don't you try doing the reverse?
Move the stuff you dont want to another module? Would that work for you?
It goes like this:
Clone the core module
Rename original module
Rename cloned module
In the core module remove what you do not need
In the cloned module Reference the entities from the original module
In the cloned module Find and replace the entities to point to the original one
In the cloned module remove the entities
Cheers
Solution
freek
Posted on 2015-07-06
freek
Rank: #542
Posted on 2015-07-06
Solution
Hi Rui,
Because I want to combine a few esapces this will not help.
Tiago:
SET IDENTITY_INSERT {Table2} ON is possible because I do not have the permissions.
Solution
Justin James
Posted on 2015-07-06
Justin James
Rank: #8
Posted on 2015-07-06
Solution
You need to do one of two things:
1. As others have stated, use the SET IDENTITY_INSERT to make this work. You have said you do not have the permissions to do this... so you can't.
2. Write a ton of code that goes through your data, inserts the values that everything else depends on into your new data model, retains the ID in a temporary mapping system... then inserts the next "level" of data, pulling from the old entities, using the mapping system to replace the IDs with the new IDs for the FK rows, and then inserting the row... over and over again...
Expect to spend a lot of time on this, test, etc.
As Rui suggested, your much better option is to leave the data in-place, and take everything else out and move it to another module.
The only time it ever makes sense to go through this painful data move is if you are merging data models from two separate eSpaces. I did this once before on a large scale and it was pretty miserable. Took about 120 man hours for a few dozen entities in three or four eSpaces to merge them into one.
J.Ja
Solution
vinodhini sri
Posted on 2016-05-04
vinodhini sri
Rank: #2304
Posted on 2016-05-04
Solution
Capture.PNG
I have created an UserExtensionModule to assign a manager to each exsisting User in "User/Roles" of my environment. I have referenced the UserExtended entity to the coreModule. But still there exists some problem in the matching of primarykey. How would we get the primary key of that particular user. Where i exactly want to use the manager is, if a user sends request it should be automatically intimated to the manager through mail. if i use "GetUserExtended(RequestTable.current.UserId).User.Manager", It shows "Key 0 not found". Please help me to fix this.
Solution
Kilian Hekhuis
Posted on 2016-05-04
Kilian Hekhuis
Rank: #5
Posted on 2016-05-04
Solution
Hi Vinodhini,
You replied to a months-old post, with a question that is not related. Please don't do that, but create a new topic for it. Thanks!
Solution
vinodhini sri
Posted on 2016-05-05
vinodhini sri
Rank: #2304
Posted on 2016-05-05
Solution
Sorry kilian. Thanks for your note.
Solution
Login to reply
New Post
Available Forums
Technology & Integration
News and Announcements
Forge Discussions
Meta
Hints and How-To Guides
Usability
Installation Troubleshooting
Personal Environment Troubleshooting
Forum Notifications
Email Digest Settings
Loading...
(hidden) New Badge Popup