Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
hiela001
Contributor
Contributor

read json Field from QVD Table

i stored many Fields from a shopDB in qvd Tabel, the Problem now is i have a Field that is in Json Format , the other Fields are normal Fields : for Expmple

ID         | Name  | creatDate | Propereties

12356| Laptop|01.01.2015|  {"height":"30","Width":"233","length":"24"}

 

does somebody have any Idea how to get 3 Fields from the Field Propereties( height-Width and length) ? 


Labels (3)
8 Replies
MayilVahanan

Hi @hiela001 

Try like below


Temp:
Load *,ID1&'|'&Name&'|'&creatDate as Key, SubField(T,':', 1) as Column, SubField(T,':',2) as Value;
Load *, SubField(PurgeChar(Propereties,'{}"'), ',') as T Inline
[
ID1 | Name | creatDate | Propereties

12356| Laptop|01.01.2015| {"height":"30","Width":"233","length":"24"}
](delimiter is '|');

GenericDB:
Generic LOAD Key, Column, Value Resident Temp;


CombinedGenericTable:
Load distinct ID1&'|'&Name&'|'&creatDate as Key, * Inline
[
ID1 | Name | creatDate | Propereties

12356| Laptop|01.01.2015| {"height":"30","Width":"233","length":"24"}
](delimiter is '|');

FOR i = NoOfTables()-1 to 0 STEP -1

LET vTable=TableName($(i));
IF WildMatch('$(vTable)', 'GenericDB.*') THEN

LEFT JOIN ([CombinedGenericTable]) LOAD distinct * RESIDENT [$(vTable)];

DROP TABLE [$(vTable)];

ENDIF

NEXT i;

DROP Table Temp;

Output:

MayilVahanan_0-1605772651861.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
hiela001
Contributor
Contributor
Author

Hi Mayil 

thank you for your help it seems to be a very good Solution. 

i'm a Qlik beginner , how should the Code be if i want to get the Data  from  QVD and not from Inline table like this Exapmle ? what i have to change ? 

hiela001
Contributor
Contributor
Author

any other Helps ?? 

MayilVahanan

Hi @hiela001 

Instead of inline table , u can use replace with ur qvd like below

Load *,ID1&'|'&Name&'|'&creatDate as Key, SubField(T,':', 1) as Column, SubField(T,':',2) as Value;

Load *, SubField(PurgeChar(Propereties,'{}"'), ',') as T 

From urqvd(qvd);

GenericDB:

......

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
hiela001
Contributor
Contributor
Author

Hi MayilVahanan,

i change the code to this one bellow, but it didn't work , there is a problem with the GenericDB Table 



________________

Temp:
Load *,id & Name &creatDate as Key, SubField(T,':', 1) as Column, SubField(T,':',2) as Value;

Load *, SubField(PurgeChar(Propereties,'{}"'), ',') as T

FROM
[C:\Desktop\Example.qvd]
(qvd);

 

GenericDB:
Generic LOAD Key, Column, Value Resident Temp;


CombinedGenericTable:
Load distinct id & Name &creatDat as Key, *


FROM
[C:\Desktop\example.qvd]
(qvd);

FOR i = NoOfTables()-1 to 0 STEP -1

LET vTable=TableName($(i));
IF WildMatch('$(vTable)', 'GenericDB.*') THEN

LEFT JOIN ([CombinedGenericTable]) LOAD distinct * RESIDENT [$(vTable)];

DROP TABLE [$(vTable)];

ENDIF

NEXT i;

DROP Table Temp;

MayilVahanan

Hi @hiela001 

is it possible to provide the example qvd ? to verify. 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
hiela001
Contributor
Contributor
Author

Hi Mayil Vahanan , 

 

this is my Example with QVD table and QVW code

MayilVahanan

HI @hiela001 

File is working fine .

MayilVahanan_0-1606525710067.png

 

If you've space in tables, then use like this

IF WildMatch('[$(vTable)]', 'GenericDB.*') THEN

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.