The CreatorCon Call for Content is officially open! Get started here.

Load one excel for multiple tables

Lean S
Mega Expert

Hi All,

I am working on import sets and transform maps. I wanted to load one excel sheet for loading in multiple tables.

This is for loading into test case and related test case steps instance

Under test plan I have to load test cases as first step and second I have to map to test case -> test case step

so from one excel sheet 

test plan -> I have load test cases

test case -> to load its related test case steps.

How can achieve using one excel sheet. Any specific coding needed for this.

 

Thanks,

Lean S

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

From single excel file you can transform data to multiple target tables.

I assume you must be having a data source to which this excel would be attached

Define the transform maps accordingly in sequence with the Order for those target tables

1st load the Test Plan

2nd Load the Test case

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

49 REPLIES 49

Hi,

For the 2 rows, the test case numbers is different. 

 

Thanks,

Lean S

Can you check the combinations with 1 or 2 or 3 columns from the xls and able to get single TC number.

You can update code to add more conditons by simply adding addQuery lines

var gr = new GlideRecord("tm_test_case_instance");
gr.addQuery("u_test_scenario","TCTEST "); //put right value and field that is unique if this is not.

gr.addQuery("tm_test_plan.short_description","TEST ABC"); //put right value and field that is unique if this is not.

gr.query();
gs.info("No. of rows are "+gr.getRowCount());
if(gr.next()) {
gs.info("Sys id is "+gr.sys_id.toString()+"---"+gr.number);
}

If this does not work, add 3rd column of xls to our query and check.

Hi,

We have like test case -> mapped to multiple test case steps

and Test plan -> mapped to multiple test cases

 

so having a new field in xls and in form, it might be anything and if we try to make unique for each record, is that works for us.

Like field name: Unique Record: TC1, TC2, TC3 like that as string field.

 

Please suggest

 

Thanks,

Lean S

 

If there is a possibility for you to add a field in your table and in xls, then yes, that the best option. Something like TC number which is unique per your test case.

Once you add that, then have this query checked with that

var gr = new GlideRecord("tm_test_case_instance");
gr.addQuery("u_new_field","TC01"); //put right value and field that is unique if this is not.
gr.query();
gs.info("No. of rows are "+gr.getRowCount());
if(gr.next()) {
gs.info("Sys id is "+gr.sys_id.toString()+"---"+gr.number);
}

Hi,

I have loaded some records and I checked like mentioned:

 

Code:

 

var gr = new GlideRecord("tm_test_case_instance");
gr.addQuery("u_unique_record","TC1"); //put right value and field that is unique if this is not.
gr.query();
gs.info("No. of rows are "+gr.getRowCount());
if(gr.next()) {
gs.info("Sys id is "+gr.sys_id.toString()+"---"+gr.number);
}

 

find_real_file.png

 

Kindly Suggest,

 

Thanks,

Lean S