Use 2 excel files in Reframework

Hello everyone,

Is this possible to use 2 excels in reframework and compare there rows

Regards,
Supriya

Hello @supu123 ,

It is possible. But it will require you to modify your implementation beyond the original project template .

Fundamentally the REFramework is meant to load a single dataset in the INIT state , get each record of that dataset in the GetTransaction State and pass it down to the Process State where it will be finally processed.

Based on your definition of what a Transaction is you will have to modify the framework.

For example: If comparing the two Excel Data tables is one big operation, then your Process will contain only 1 major transaction. In this case you may modify the framework as follows:

  1. In the INIT state you will load Excel 1 into Data Table 1
  2. Your TransactionItem will be of type DataTable and the Get Transaction state will simply pass the entire Data Table 1 to the Process State
  3. Along with the TransactionItem you may pass the path of Excel 2 as Transaction Data
  4. Because the Process State has the URL to Excel 2, it will load this Excel 2 into Data Table 2
  5. Then it will do a comparison of the two Data Tables and output the results the way you want.

I hope this helps

Thanks

Hi @AndyMenon

Can u elaborate step 2 and 3 a little more

Thankyou for support

Thanks and Regards,
Supriya

Ok, this is one type of implementation that makes the following assumptions:

  1. Excel 1 is the reference Dataset1 - it will be loaded during the INIT state
  2. Excel 2 is the varying Dataset2 - it will be compared with Excel 1 in the Process State
  3. In the Process State , the Process.xaml will load Excel 2 and perform the comparison operation between Dataset1 and 2
  4. The entire process is a One Unit transaction - meaning, the Process will stop once TransactionCount reaches 1

With these assumptions, this is how the Framework is going to be set up:

Main.xaml

  1. The TransactionItem will be of type DataTable
  2. TransactionNumber will be initialized to 1
  3. Transactionfield1 will be a plain string and it will be the Path to Excel 1
  4. Transactionfield2 will be a plain string and it will be the Path to Excel 2

Alternately, you can enhance Main.xaml to have 2 input arguments. You can pass the paths to the two Excel files as arguments and your automation will become versatile enough to process different files

The INIT State

Within INIT State you will implement the activity to load Data from Excel 1 and assign it to TransactionItem DataTable

Transaction State

image

  1. The Transaction State will simply pass the TransactionItem DataTable (Excel 1) down to the Process State
  2. The io_TransactionData argument of the GetTransactionData.xaml is modified to DataTable
  3. Obviously, in this xaml, the TransactionNumber count is limited to <=1 as per our assumptions above

Process State

  1. The Process.xaml accepts the TransactionItem from the Transaction State.
  2. Therefore, you can modify this file to accept the supplemental Transaction data
  3. In this case, it will be the Transactionfield2 that is the full path of Excel 2
  4. As usual, the in_TransactionItem has to be set to DataTable to accept the Excel 1 DataTable

Alternately, you can modify Process to accept both, the Transactionfield1 and Transactionfield2 because the Process state should have access to these pieces of information as it the one doing all the work and executing the process logic.

Process Implementation

So, by the time you hit Process.xaml, it has access to both - the Excel1 in the form of in_TransactionItem DataTable, and Excel 2 in the form of the file path in_Transaction_Field2

  1. In Process, you will use the Excel 2 file path to load data into DataTable 2
  2. Implement the business logic between DataTable 1 and DataTable 2
  3. Any other additional logic

These steps constitute a Single-Unit Transaction Process. Once the Process.xaml has executed successfully once, the Process will stop because the Transaction State will not return a valid transaction as the TransactionNumber has been incremented to 2 .

You can use this as a starting point and set up different ways of working with the two Excels.

I hope this helps