Tuesday, November 29, 2016

Text Tables

Hey guys,

  • are used to fetch the description based on user's session language.
  • once implemented, it automatically find out user's language and give description in that language. 

1) Product(table) contains Product ID and Product Name 
2) PRODUCT_TEXT_TABLE(text table of product) contains the description of products in different languages. 
      a)i.e. "cotton shirts" in english and "BaumWoll Shirts" in German

Purpose:

    Create a calculation view gives 
               Product Name and Product Description(only in user's session language)

How to Implement?
  1.       Open Hana Studio
  2. Create 2 tables ( Product and PRODUCT_TEXT_TABLE)  --- directions on Bottom of page
  3. Right click on your schema and referesh to see the 2 tables
  4. Go to "content" and right click on the package, select calculation view
  5. Give name and description of the calculation view.  Select data category as "Dimension"
  6. Add a "join" block and add both the tables  "PRODUCT" and "PRODUCT_TEXT_TABLE"
  7. Make a join on the column "PRODUCT_ID".  Specify the join types as "text join".  click on the "language" column.  Add "PRODUCT_ID", "PRODUCT_NAME" and "PRODUCT_DESCRIPTION" to output.
    8. Select the Type of columns as "attribute".  This may be selected by default.  Save and activate the view.


Directions How to create the tables:


-- REPLACE WITH YOUR ACTUAL SCHEMA NAME

-- PRODUCT table
CREATE COLUMN TABLE ""."PRODUCT"(
            "PRODUCT_ID" INTEGER ,
            "PRODUCT_NAME" VARCHAR(20) ,
            primary key ("PRODUCT_ID"));

-- PRODUCT text table
CREATE COLUMN TABLE ""."PRODUCT_TEXT_TABLE"(
            "PRODUCT_ID" INTEGER ,
            "LANGUAGE" VARCHAR(1),
            "PRODUCT_DESCRIPTION" VARCHAR(50) ,
            primary key ("PRODUCT_ID", "LANGUAGE"));

insert into ""."PRODUCT" values(1,'Shirts');
insert into ""."PRODUCT" values(2,'Jackets');
insert into ""."PRODUCT" values(3,'Trousers');
insert into ""."PRODUCT" values(4,'Coats');
insert into ""."PRODUCT" values(5,'Purse');

insert into ""."PRODUCT_TEXT_TABLE" values(1,'E', 'Cotton Shirts');
insert into ""."PRODUCT_TEXT_TABLE" values(1,'D', 'Baumwoll-Shirts');
insert into ""."PRODUCT_TEXT_TABLE" values(2,'E', 'Leather jacket');
insert into ""."PRODUCT_TEXT_TABLE" values(2,'D', 'Lederjacke');
insert into ""."PRODUCT_TEXT_TABLE" values(3,'E', 'Trousers and Pants');
insert into ""."PRODUCT_TEXT_TABLE" values(3,'D', 'Hosen und Hosen');
insert into ""."PRODUCT_TEXT_TABLE" values(4,'E', 'Coats and Blazers');
insert into ""."PRODUCT_TEXT_TABLE" values(4,'D', 'Muntel und Jacken');
insert into ""."PRODUCT_TEXT_TABLE" values(5,'E', 'Purse and Handbags');
insert into ""."PRODUCT_TEXT_TABLE" values(5,'D', 'Geldburse und Handtaschen');

    
    

No comments:

Post a Comment