Online Safety Community

Introduction

I was recently at a client site when a conversation about data typing in QlikView Online Training began. It involved the client noticing that a listbox they had placed on an application was displaying dates both left aligned and right aligned. What had caused this?

What’s Happening?


Most programming languages have well defined data types: Int, String, Decimal, Double, Array, and so on. Most relational databases also have the same for the fields you define within a table. Other products also guess at a type: ever had Excel convert something to a String when a Number was wanted? QlikView does not have a defined type that a developer can use but they do internally make use of two.

In order for QlikView to be able to play nicely with all the places from where one would want to load data, it abandoned the formal definition of types within the load script, data model and user interface. I can see programmers all over the world begin to cringe at the thought of no type safety, but have no fear: this is what allows the connecting of fields by name in the associative data model – a data model that may have differing underlying types. This also allows the loading of data from Excel, SQL Server and Oracle all within the same application and without any type conversion problems.

It is a very common occurrence to load data from a CSV file, Excel file, QVD file and a SQL Server database into a QlikView application. If type safety were needed, the few hundred lines of load script needed for that would be significantly higher and development would be slowed down. There would also be more errors during the casting and conversion processes. In order to keep the creation of a QlikView application simple – from loading the data to using it – QlikView uses interpretation. It only internally stores and uses two data types: String and Number. If a field cannot be interpreted as a Number, only the string value will ever be used. When loading data from a QVD, QlikView does not interpret the data because it already was interpreted during the QVD’s creation.

When data is loaded all data will come in as a string. QlikView will ALSO try to interpret it as a Number if it can during the loading of the field. It will keep track and make use of the appropriate type based on how that field is used in the document.

There is a built in function ( [dual(s, n)] ) that can be used while loading a field within the loadscript. The “s” parameter is the string or display value for field and the “n” parameter is the numeric value for field. This allows a developer the chance to use a different type for either the display or numeric usage of the field.

One other advantage of QlikView not having a data type is apparent during calls to a function. In most cases the calls are simply of the form [function_name(field)]. If the function requires a String, then QlikView uses the string value for the field. If the function requires a Number then the number values for the field is sent.

Conclusion


In the case of the customer mentioned earlier, it was clear that the date being read in was being interpreted as a string in one case and couldn’t be converted to a number, where as other dates were being read in as a string but were able to be converted to a number. Since QlikView has no problem displaying both Numbers and Strings in a listbox, it happily displayed the data both ways.

I hope this article helps you understand how QlikView is not only able to load data from multiple source systems but also maps a display and a numeric value for each field loaded.

Update:

I am updating this article because I encountered a similar situation to this again and I wanted to share the solution.

Recently I was needing to import data into QV from a TSV file that was created from an Access Database export. I needed to import a field that was of the format ‘MM/DD/YYYY hh:mm:ss’ and I needed QV to be able to store this properly as a  dual(s, n) as it normally would when encountering a date field. However I always ended up with a NULL value. The following statement worked on this field.

date(floor(date#([Old Date],'MM/DD/YYYY hh:mm:ss')),'MM/DD/YYYY') as [New Date]

That statement allowed me to have a properly formatted string for display (without time stamp) and for easy date math with the numeric value.

Source: resultdata

Views: 81

Reply to This

Take our poll!

Take our poll!

Latest Activity

Mark Nilson posted an event

Data analysis with Pivot Tables: take your knowledge to the next level at Training Doyens 26468 E Walker Dr, Aurora, Colorado 80016

July 2, 2019 from 1pm to 2:30pm
OVERVIEWLearning how to create Pivot Tables in Excel is one of the must-have skills for anyone who needs to use Excel to build business reports and summaries. Our upcoming webinar discusses how to quickly and easily build reports and charts that help in spotting trends and making crucial business decisions.The webinar covers the following key areas:Calculating month-on-month difference and using conditional formattingUsing…See More
41 minutes ago
Kelly Wilson posted a blog post

Value of Locating the Right Plastic Surgeon

If you are taking into consideration for any plastic surgery treatment, discovering the best plastic surgeon is of prime importance. There might be several plastic surgeons supplying plastic surgery, as well as you have to find a plastic surgeon that can aid accomplish your visual objectives. As laser lipo is an advanced procedure, just a doctor having the right skills can guarantee you risk-free and optimal outcomes. Pointed out here are some of the factors for choosing the…See More
yesterday
Training Doyens posted an event
Thumbnail

Creating Raving Fans for Business: How to Develop a Winning Strategy for Client Retention and Customer Satisfaction at 26468 E Walker Dr, Aurora, Colorado 80016

July 31, 2019 from 1pm to 2:30pm
OVERVIEWA ‘Strategy of Pre-eminence’ and understanding what ‘Moments of Truth” are, gets this session underway. When you learn the actual $ dollar value of one of your customers, gained or lost, you may start looking at training in customer service in a better light.We will look at three key customer complaint and resolution questions everyone needs to know:What causes…See More
yesterday
Morgan Franklin posted a blog post

A guide to keeping your kids safe at home

As a parent - no matter how old your child is - you have a number of responsibilities to your child: to make sure they are properly taught important life skills; to make sure they’re happy and healthy; and, most importantly, to ensure that their home is a safe place for them. There are many elements to this, and there are many dangers facing people in everyday life, but every parent must keep their child safe at home, whilst striking a balance between keeping them safe and healthy and…See More
yesterday

Forum

Workplace safety for workers other than your own 3 Replies

Do your workplace/traffic safety plans include safety measures for workers who are not your own employees? Do they take into account the safety of those who will be - or could be - at your workplace,…Continue

Tags: emt, paramedics, emergency, occupational, health

Started by John Petropoulos Memorial Fund. Last reply by Paul Lancaster May 28.

Imagine a technology which is an artificial muscle and is integrated into textiles...

Such a smart textile has huge application potential and can support people in many different ways. The garment would use haptic feedback (i.e. the use of touch to guide the user) or could serve as a…Continue

Started by Ulla Siegel May 28.

Green Smart Technical 800+ Turnkey Projects in UAE – Rope Access Company in Dubai

Green smart is an ISO 9001: 2015 QMS, OHSAS 18001: 2017 OHSMS, ISO 14001: …Continue

Tags: window, cleaning, services, facade, companies

Started by Manikandan Apr 23.

What % of Dollars should be bugeted for All Safety Training for a "Heavy Equipment Road Construction" company with 100 employees? 1 Reply

I have been at a Highway and Road Construction company for six months. I am developing a (first) complete training program. I am the 1st full time safety hire for this company. I need to develop a…Continue

Started by JTurpening. Last reply by Jen McDade Feb 19.

Technology and Safety 1 Reply

What are the most useful tools to have at your fingertips? -Toolbox Talks-JSA-JHA-Daily Reports, etc. What is falling through the cracks that could be an easy fix? Safety Managers, Coordinators and…Continue

Tags: safety

Started by Drew stone. Last reply by Jen McDade Feb 15.

Badge

Loading…

© 2019   Created by Safety Community.   Powered by

Badges  |  Report an Issue  |  Terms of Service