Need Help - Building Function to Dump Tables before Environment Reset

I am building out our Kinetic environment and need to wipe the database to set things up differently. The issue I am facing is that I cannot copy the database to Production because I am SaaS and they are currently different versions. I can easily create a bunch of BAQs and run them all and save the results to Excel, but to have to do that every time for every table is very time consuming. Plus I would have to export all the BAQs and import them into the new environment, etc. etc. :face_vomiting:

What I want to do is build a Function that grabs all of the tables and dumps them to the Server folder. Then I can just download all the files and be done.

I planned on either using the DB tables in code or an Invoke BO Method to get the data. Once I get the data, I want to drop a CSV to the Server folders. This is where I don’t know enough to accomplish this.

Can someone help me get the data, convert it, and dump it to a csv using Ice.Contracts.FileTransferSvcContract? Or if there is a better solution that I do not know about?

Thanks in advance.

I’ve been trying to start working on a tool for this in my spare :rofl: time.

Are these specific tables? How much data are we talking?

Explain more.

I planned on building a Library of Functions to pull all sorts of tables. Off the top of my head, I was thinking Company, Part Class, Parts, etc. All master data tables, not transaction ones.

I could build it out if I just knew how to convert either a TableSet or LINQ query to a csv.

Once built, you could then just export the Library before reset and import if you planned another reset. I was also thinking of creating a Process Set that I could export that would run all the tables I wanted.

Was it @mbayley that creating a new company at insights?.. Not sure if that has any value.

I have a DMT setup that copies a company, but it was designed for on-prem and and environment I was using at the time so the fit might not be perfect… It’s based on the DMT powershell github repo, but uses an editible file to generate data, or generate and import.

Maybe it might be modified to call the functions you are creating.

Take a look at it here Feedback appreciated…

Might I suggest DMT :smiley:

I have had a further think on this. I you would not even need to functions to do this.

Thanks @Chris_Conn for reminding me not to overcomplicate things.

I also have a list of scripts used that could also be used with my prior mentioned tools that give the order of things… Not sure if it is 100% complete now, but I can share that too just let me know… I had used it to create a new company in the Demo Database (why I did this I have no idea :scream: )

Because you are cloud my suggestion would be to use BAQs as the data source and use the a modified PowerShell script and load that way.

Here is a link to the Epicor Github powershell repo

The laborious part is doing all the BAQs. For an initial test just use the required fields and you can expand from there.

I built it. Gotta finish it up.

You can buy me some drinks next May…

Hmmmm I can feel some more Karaoke coming on…

@knash please rescue Kevin in the morning. :slight_smile:

More Karaoke, sure.

Needing rescuing again? :thinking: I hope I’ve learned my lesson. :nauseated_face:

party bus to Karaoke…On it…

And I hear we may have an extra passenger that will really be deserving to celebrate :slight_smile:

I’m out of the loop, what’d I miss?

I am sure all will be revealed in good time, correct @knash?

Looks like this is turning into a :dumpster_fire: perhaps we should move this part of the convo over to the off Topic Karaoke thread?

@jkane choice.

I like :dumpster_fire:

@Hally , I had originally thought about doing something with DMT and BAQs, but it was the maintenance I was looking to avoid. I know it can be done with that, but once Epicor changes something, you now need to change the BAQ.

My thought was that if you build a Function for each table (or tableset), even if Epicor updates the table, you will still get the whole thing automatically. I want to build this thing once and just export and import as needed.

Chris is spot on. This is similar to what Epicort does with seed data. They don’t copy from another database but quickly load from files - not necessarily DMT, but they are assuming an empty database. And like @Hally says, we can create those files with BAQs.

I think this would be a great way to set up test data for dev environments as well.

We could have the function update the BAQs… :thinking:

Why does version control keep popping into my head…

Now you need to create Functions and BAQs? Seems counter-productive.

With DMT not all fields are required, only the mandatory fields and the ones you need.

Epicor is only going to update the schema on updates and being diligent person as you are you are reading the release notes in a timely fashion to pick that up to make the BAQ changes. :stuck_out_tongue_winking_eye: