Qlik Community

Ask a Question

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Master
Master

Load data from ruby file

Hi All,

Please any can help me how to get data from ruby file

15 Replies
Not applicable

What type of files these are ?

Try with fixed delimited format

Master
Master

Hi Dathu,

Please see below code:

require 'rubygems'
require 'mysql'
require "rspec"
require 'rspec/expectations'
require 'active_support/deprecation'
require 'active_support/dependencies'
#ActiveSupport::Dependencies.autoload_paths << File.expand_path(File.join(Dir.pwd, 'lib'))

def r_for_retailer(retailer)
retailer = retailer.downcase
  case retailer
  when "Targetus"
    $r1="Target-US--List"
    $r2="Target-US--Detail"
    $product_count = 3842
    $brand_count = 1
    $swatch_images = true
    $product_images = true
    $product_description = true
    $product_details = true
    $colour_tags = true
    $menu2_tags = false
    $currency = "USD"
    $country = "US"
    $retailer_name = "Target-us"
  when "Relianceus"
    $r1="Reliance-US--List"
    $r2="Reliance-US--Detail"
    $product_count = 5000
    $brand_count = 1
    $swatch_images = true
    $product_images = true
    $product_description = true
    $product_details = true
    $colour_tags = true
    $menu2_tags = false
    $currency = "USD"
    $country = "US"
    $retailer_name = "Reliance-us"
  when "little"
    $r1="Little-List"
    $r2="Little-UK--Detail"
    $product_count = 7966
    $brand_count = 249
    $swatch_images = true
    $product_images = true
    $product_description = true
    $product_details = true
    $colour_tags = true
    $menu2_tags = false
    $currency = "GBP"
    $country = "UK"
    $retailer_name = "little-uk"
  when "Hollandus"
    $r1="Holland-US--List"
    $r2="Holland-US--Detail"
    $product_count = 10248
    $brand_count = 464
    $swatch_images = true
    $product_images = true
    $product_description = true
    $product_details = true
    $colour_tags = true
    $menu2_tags = false
    $currency = "USD"
    $country = "US"
    $retailer_name = "Holland-us"
 
  end

end

AfterStep do
  if !$retailer.eql?$old_retailer
    connect_to_database
    #   create_schema
    robots_for_retailer($retailer)
    #  copy_data_in_database
  end
  $old_retailer = $retailer
end

at_exit do
#  write_statistics
  $db.close
end
end

When tried to load data its its only support fixed record option.

Status.PNG

Not applicable

Why are you trying to load the code in the QV Script. I think you must convert this file into more QV based readable format.

Thanks,

Angad

Partner
Partner

Give more details please , so we can help you!

Fernando

Not applicable

Hi Nitha, can you please post the sample file and expected O/P from file.

Master
Master

HI Dathu,

In the post how do we upload document files,i can see only  uploader for image,video and url link

Thanks

Nitha

Master
Master

Hi Angad,

I tried,but unable to find how to covert the ruby file to desired file format.

Is there any way to convert this to desired file format.

But there is disadvantage,i want to load the ruby file daily,

as its going to change when there is changes in values

I want the straight table column values to be flag based on the values in ruby file.

Thanks

Nitha

Master
Master

Hi fernando,

I want the straight table column values to be flag based on the values in ruby file.

we have retailers data collected(products,prices,brands,etc) in db everyday.
i have devloped a dashboard with straight table with retailers as dimension and
the data is collected every day ,data in db is compared to values in ruby file and
if values in db is within tolerance to values in ruby file the retailer is passed or else failed.
so i want to compare these values and put pass/fail status against a retailer for particular
date.
this report gives daily status of retailers.
i am unable to load ruby file.
Thanks
Nitha
MVP & Luminary
MVP & Luminary

Your Ruby script appears to update a MySql table (named Retailer?). So you should load from the MySql table using ODBC.

-Rob