Export and then Import of business object data

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ask180
Posts: 160
Joined: Thu Oct 04, 2012 11:40 pm

Export and then Import of business object data

Post by ask180 »

Assume I have two business objects named Idea and Task. They have a one-to-many relationship (one Idea may have zero or more Tasks, and each Task relates to one Idea).

I want to export the data from these two business objects, and import them into a duplicate bsv, maintaining relationships etc), and I want to do this as a process (rather than Export/Import one BO at a time).

The data export works fine. All the columns and all the rows are exported to appropriate csv files.

I can get Idea data to import, but Task data won't because the export has the shortcut to Idea as a column, and this throws an error. I would have thought that the IMPORT function would know to ignore shortcut columns as they don't have data.

I have searched the forum, and read the documentation, and have tried all combinations of everything, but the error remains.

Is there a trick to importing data into a business object that references (owned by) another business object?
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Export and then Import of business object data

Post by PointsWell »

If you were doing it manually you can use a reference to the owning BO

Eg.
Idea has
ID - unique

Task has
ob_Idea

The CSV for Task would have as a column

Task.ob_Idea.ID, Task.Title, Task. Etc

When you load the CVS for tasks it will find the Idea by reference number and then build the link,

You don't need to use ID, you can use any attribute of Idea as long as it is unique - if you use non unique columns then it becomes problematic.

Also you need to load your BOs in the correct order. If you load Task before Idea it will create a bunch of empty records with the the ID (or other unique field that you used) and no other data.
ask180
Posts: 160
Joined: Thu Oct 04, 2012 11:40 pm

Re: Export and then Import of business object data

Post by ask180 »

Thanks for your reply.

The problem is that when I export Task business object from a process (not the menu option Export), it includes a column for the Idea shortcut for some reason, and I can't find a way to stop it doing this. When I attempt to import the data, I get an error saying that it can't import shortcut fields.

When exporting by rules, how can I stop the process exporting the shortcut columns? I tried using a query, but it exported all the columns irrespective of what columns I had displayed in the queue.

I will keep trying.
Jhstephenson
Posts: 297
Joined: Wed Apr 22, 2015 11:44 pm

Re: Export and then Import of business object data

Post by Jhstephenson »

Did you ever resolve this? I am running into the same issue.
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Export and then Import of business object data

Post by Jaymer »

not sure what ask180 was doing, but Jim,
are you using EXPORT USING syntax,
-And- using an Export Template?
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Jhstephenson
Posts: 297
Joined: Wed Apr 22, 2015 11:44 pm

Re: Export and then Import of business object data

Post by Jhstephenson »

No. I am just doing an
EXPORT BO TO 'D:\Temp\BO.csv' FOR UPDATE

I am actually doing this for about 25 files. So, I was trying to avoid creating a template (lazy, I know).

I didn't realize that it included shortcuts until I tried to import the CSV and the it started popping up with errors.

The reason I am even having to do this to begin with is that every time I restart the control panel my test database gets screwed up and I have to rebuild all of my test data. So, I am just trying to create a quick process to export/import data that I can run periodically.
ask180
Posts: 160
Joined: Thu Oct 04, 2012 11:40 pm

Re: Export and then Import of business object data

Post by ask180 »

I never resolved this issue.
ACDC
Posts: 1138
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Re: Export and then Import of business object data

Post by ACDC »

Code: Select all

So, I am just trying to create a quick process to export/import data that I can run periodically.
Why not use a database editor/explorer to run this instead of AwareIM by simply copying the tables over from a backup . You can simplify this even more if you are setting up unique database names as opposed to the basdbtest and basdb version.

I am not sure about the import shortcut issue, but normally when I do an import of this nature I import the two objects separately and then rely on an object rule on the Task object to link it to the the Idea object using the ID of the Idea object embedded in the task object
customaware
Posts: 2391
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Export and then Import of business object data

Post by customaware »

I have been using this for about a year now....

The best I have ever found for RELIABLY moving data from one DB to another....
Production Server to Test Server
Between DB on Test Server
etc etc.

So... In your situation....

Duplicate all your data to another db on the same server.
You can same any migration you regularly use as a template.
So bring the data back if something screws up is a snap.

Handles all manner of configs.... Replace Table, Empty Table blah blah.
Handles auto increment db columns.

Only thing you will need to do manually is the latest Sequence value from the Source DB.

I have found it way better and more reliable that Navicat.

Not to expensive. But Windows only.

ESF Database Migration Toolkit - 10.3.08
https://www.dbsofts.com/
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
Jhstephenson
Posts: 297
Joined: Wed Apr 22, 2015 11:44 pm

Re: Export and then Import of business object data

Post by Jhstephenson »

Thanks Mark, I will take a look at that.
Post Reply