Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ivan_will
Partner - Creator II
Partner - Creator II

Hyper Interesting case !!! Need professional help

Hi all,

[View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/1122.QVapp.rar:550:0]

In the pic below I'm showing whats the case:

I'm trying to catch some strings from the field images and put them cleared in another table, but the script I'm using don't do that correctly but seem to working to the 6th line fine!

In the attached app you can see it.

error loading image

I've trying to fix the bug in the app but without any success ... please help!

Thanks in advance!

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi,

As I mentioned above, the code above works with a small tuning:

for h=1 to NoOfRows('main2') data2.1:LOAD $(h) as ID, substringcount(imagess, '.jpg') as JPGInstances, RecNo() as images_recNo, TextBetween(SubField(imagess, 'alt='), '/Autotest/', '.jpg') as final_imagesRESIDENT main2 WHERE ID = $(h); next


Please take into account that the people that participate in the QlikCommunity don't have your data model, nor we work for QlikView, so some ideas will need refination from your end.

Hope that helps.

View solution in original post

9 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Ivan,

it took me a few minutes to find the catch... You are using function fieldvalue(), which is giving you an X-th element from the list of field values. So, you expected to see the first line under number 1, the 7th line under number 7 and the 11th line under number 11... Well, the catch is that the List with field values only stores distinct values, so your line # 11 contains 7th distinct value of the field imagess - that's why the images from line 11 got registered under number 7...

In order to get correct values, replace FieldValue() with function Peek(), where you can specify the table name and the row number in the table, to get the accurate value without any de-duplication problems.

cheers,

ivan_will
Partner - Creator II
Partner - Creator II
Author

Use that function let vImages = text(peek('imagess',$(h)-1,main2)); but it gives only the first line info !

?

ivan_will
Partner - Creator II
Partner - Creator II
Author

Any ideas ?

Miguel_Angel_Baeyens

I've changed a bit your script

for h=1 to NoOfRows('main2') data2.1:LOAD Distinct $(h) as ID, substringcount(imagess, '.jpg') as JPGInstances, RecNo() as images_recNo, SubField(textbetween(imagess, '/Autotest/', '.jpg'), '=') as final_imagesRESIDENT main2 WHERE ID = $(h); next


Obviously this needs some tuning, but the idea is that the SubField() function, unless a count number is specified, will create as many records as separators it will find in the string:

Example:LOAD SubField(Field, '=') AS Field INLINE [FieldA=B=CD=E=FG=H=I];


But I'm afraid I'm unable to get how you want to split your code exactly.

Hope that helps.

ivan_will
Partner - Creator II
Partner - Creator II
Author

Hi ,

want to have this as result :

so one ID have no, one or more jpg. in the original text and want to have it all.

🙂

ivan_will
Partner - Creator II
Partner - Creator II
Author

Ahmm ... , another ideas how to do that work ?

ivan_will
Partner - Creator II
Partner - Creator II
Author

?

Miguel_Angel_Baeyens

Hi,

As I mentioned above, the code above works with a small tuning:

for h=1 to NoOfRows('main2') data2.1:LOAD $(h) as ID, substringcount(imagess, '.jpg') as JPGInstances, RecNo() as images_recNo, TextBetween(SubField(imagess, 'alt='), '/Autotest/', '.jpg') as final_imagesRESIDENT main2 WHERE ID = $(h); next


Please take into account that the people that participate in the QlikCommunity don't have your data model, nor we work for QlikView, so some ideas will need refination from your end.

Hope that helps.

ivan_will
Partner - Creator II
Partner - Creator II
Author

Ooo, that's great ! Thanks! It works !!! 🙂

Thanks again for the help!