Difference between revisions of "Rate import from CSV"

From Kolmisoft Wiki
Jump to navigationJump to search
Line 167: Line 167:
== 7. Creating new rates ==
== 7. Creating new rates ==


Finally, MOR creates all rates and we are all done!
Here, MOR creates rates that have not existed previously. Click ''Proceed'' afterwards.
<br><br>
<br><br>
[[Image:rateimportfromcsv9.png]]
[[Image:rateimportfromcsv9.png]]
<br><br>
<br><br>
== 8. Deleting rate ==
This is the final step. MOR deletes the rates which were not a part of the file being imported.
You're all done!
== NOTES ==
== NOTES ==



Revision as of 13:37, 12 May 2014

File format

File should be CSV (comma separated values).

Necessary fields in CSV line:

  • Prefix
  • Price

No other fields are necessary.

First line can be header.

Value Separator and Decimal Separator MUST be set correctly in SETTINGS -> Setup -> Settings -> Functionality:

  • CSV Column Separator
  • CSV Decimal Separator



Settings-functionality.png

File and CSV separator settings should match. If they do not, you will get errors when trying to import file.



Where can I get an example file with available prefixes?

Go to SETTINGS -> Billing -> Tariffs and click on Icon excel.png Destinations CSV.

Description

It is very tedious work to add several thousand rates by hand, so you can import them from a CSV file.

There are seven steps for importing rates from a CSV file:

  1. File upload
  2. Column assignment
  3. Column confirmation
  4. Analysis
  5. Creating destinations
  6. Updating rates
  7. Creating new rates

We will cover each of these one by one.

IMPORTANT NOTE: When importing, prefixes should be in E.164 format!!! For example, no international prefixes!

1. File upload

Select Excel.png Import from CSV for the Tariff you want to import rates.

Then click on Browse and select CSV file with rates. Click Upload file:

Rateimportfromcsv1.png

2.1 Column assignment - wrong separators detected

Sometimes the system is able to detect that CSV separators are wrong and suggests you to change them:

Tariff import wrong separators.png

2.2 Column assignment

The file is uploaded and the first five lines of the file are available to check:

Rateimportfromcsv2.png

This helps us in the next step, to assign CSV file's columns to MOR's variables. We have the following window:

Rateimportfromcsv3 2.png

Here we must assign columns from the CSV file. Prefix and Rate are mandatory fields. All other fields can be empty. Connection Fee, Increment and Min. Time have their defaults. If you wish, you can enter values manually for them. Manually entered values have the highest priority. If you omit them, then MOR inserts values from the CSV file. If there is no assigned column for these fields, then default values will be added to database (DB).

You can also import Ghost Percent with the rates. It works the same way as the Ghost minute percent in the Calling Cards Groups: it is a value to trick the user into thinking he has more minutes when he really has less.

This way of selecting CSV rows and assigning them to MOR values lets us import various CSV file formats.

Additional options



Importfromcsv.png

Rate Day Type
It is possible to select to which Day Type rates apply before importing them.

So in two steps it is possible to import separate rates for Work Days and Free Days, or (in a single step) to import rates for All Days at once.

On/Off Peak Tariff import
If you need to import tariffs for on/off peak periods, all you need to do is upload another tariff on top of the one you have with a different time period.

  • You are now able to specify peak and off-peak periods (hours, minutes, seconds) when importing tariffs for work days and weekdays.
  • Important notice - time periods cannot cover each other.
  • If for example you upload a tariff from 8am to 12pm. The Tariff that is uploaded on top can only be from 12pm to 8am.

Update Destination Names from file

When this option is selected destination name is updated from csv file during rate import.

Update subcodes from file

When this option is selected subcode is updated from csv file during rate import.

Updating Directions for Destinations based on Country Code

This functionality lets you reassign Destinations to different Directions by Country Codes specified on CSV file. When Update Directions for Destinations based on Country Code: is selected country code field is necessary.

Update Destinations Groups

When this option is selected all(old and new) destinations are assigned to correct Destination Groups by Country Codes and Subcodes.

Delete Rates for Prefixes which are not present in imported file

This option allows you to delete existing rates, which will not be updated.(The prefixes that belong to these rates are not a part of the file being imported).



3. Column confirmation

The next step is to review our selection and confirm that everything is correct. We can go Back or forward to the next step:

Rateimportfromcsv5.png

NOTE Steps where is nothing to do (value = 0) will be skipped.

4. Analysis

It will take some time to accomplish this step. MOR checks many things from DB and CSV files: it compares rates, searches for duplicates, fixes small errors and so on. After the analysis is completed, we get something like this :

Rateimportfromcsv6.png

The most interesting line is 9 bad destination(s). We click on the List to check them. In the new window, we can see which destinations are bad and we can decide what to do with them. Is it possible that there are no directions for them, MOR doesn't know to which country to assign this destination, or maybe these destinations have duplicates in CSV file? You have to fix this if you want to import the whole file. Here you can stop and fix your CSV file, or you can ignore these errors and continue.

We continue the demo by clicking Proceed.

The following steps are separated to avoid excessive demands on processing power if a rate file is huge. This keeps the browser from crashing and allows it to successfully import 160.000+ destinations from one CSV file (this has been tested).

5. Creating destinations

MOR creates new destinations here. These destinations are necessary for the rates, which will be added in step 7. This window is just informative, no decisions here:

MOR creates only Destinations for prefixes which are not yet in MOR's DB and determines whether it is possible to find out the Direction (Country) for these new prefixes (Destinations).

This may be done in two ways:

1. The system checks the available prefixes for the best match and selects found Direction as a basis for the new prefix (Destination).

For example: if you try to import the rate for prefix 370630 and this prefix is unknown to MOR, MOR checks the longest matching prefix - 3706 in this case - and finds out that it is Lithuania MOB. So it creates a new Destination with Prefix 370630 in which the Direction will be Lithuania and the subcode MOB (mobile network).

2. If Country code is available in the imported file, MOR assigns this Direction to the newly created Destination.

For example: if again you try to import 370630 and it is unknown to MOR, but you have LTU in same CSV line for Country Code field, MOR will create such a Destination with Direction = Lithuania.

Rateimportfromcsv7.png

NOTE Because Destination cannot be empty (space), during the Destination creation, MOR automatically sets Destination name as Direction, if SubCode is selected to import, Destination name will be Direction + SubCode.

6. Updating rates

Here MOR updates rates with the values from CSV files. These rates already exist in DB. Just click Proceed:

Rateimportfromcsv8.png

7. Creating new rates

Here, MOR creates rates that have not existed previously. Click Proceed afterwards.

Rateimportfromcsv9.png

8. Deleting rate

This is the final step. MOR deletes the rates which were not a part of the file being imported. You're all done!

NOTES

Rate import is VERY CPU-intensive.

If there are a lot of rates, please be patient and let MOR finish its job. It may take some time to count everything and come back to life.

At some point it may seem that browser is not responding. That is not the case – it is just working very hard, importing your very own rates from the CSV file.

If you get a timeout error, try to import the file in smaller pieces.

Destination to create from CSV

When importing rates from the CSV file, you can check which Destinations will be created automatically.

You can view them in a separate window when you click List in step 4 in the field "Destinations to create".

Such destinations do not exist in MOR's database but MOR will create them when importing the rate file.

More info: Integrity Check

Example Videos

<flashow>http://wiki.kolmisoft.com/videos/rates_import_from_csv.swf%7Cwidth=600%7Cheight=455</flashow>


Similar video with different tariff:

<flashow>http://wiki.kolmisoft.com/videos/tariff_import_from_csv.swf%7Cwidth=800%7Cheight=618</flashow>

See also