Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Selection from file

Hi.

I'm trying to make a function that allows the user to have their own text document with chassi numbers that they want to select in the application. I think this must be done in a script that the users can call when they want.

Reading the file and clearing the field from choises is no problem. (strText = txsStream.ReadAll) (ActiveDocument.Fields("ChassiNo").Clear)

My problem is how to transfer the choices from my readout to the variable (ChassiNo) in the application. I have tried "ActiveDocument.Variables("ChassiNo").SetContent strText, true" with no luck.

Any sugestions on how to do this?

5 Replies
matt_crowther
Luminary Alumni
Luminary Alumni

Varis,

This may not work in your situation but it could point you in the right direction.

If the txt file containing the relevant Chassis No's is loaded in via a partial reload and then inner joined to the rest of your dataset it will be the same as the user making those selections manually.

Of course the drawbacks are: the user must be able to initiate a partial reload (so server based is probably out) and secondly once the inner join has occured you can't 'clear all' back to see all values.

You may be able to simply join the .txt file Chassis No's to the data and create a mapping value that the user can then select to show the Chassis No's from the txt file.

Hope that helps,

Matt - Visual Analytics Ltd

Not applicable
Author

Hi Matt,

Thank you for your answer. The users want to be able to clear their choices and therefor this solution is not suitable for me .

There should be some way in the vbscript to make the selections that are in the file.

//Varis

Not applicable
Author

To read one line from a text document is no problem using "ActiveDocument.Fields("ChassiNo").Select strText, true"

This works as long as I don't have more then one row, when I have two or more rows the code don't work. Has anybody had this problem and could point me in the right direction?

matt_crowther
Luminary Alumni
Luminary Alumni

In that case try simply joining the Chassis No's to the data set with a traditional Qv association therefore allowing you to create a list box that allows users to select 'In .txt', 'Not in .txt' or clear for all values in the document.

That way your users have access to the whole data set but can also quickly and easily select the values from their .txt file.

Hope that is of a little more help.

Matt - Visual Analytics Ltd

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP


Kari Varis wrote:
To read one line from a text document is no problem using "ActiveDocument.Fields("ChassiNo").Select strText, true"
This works as long as I don't have more then one row, when I have two or more rows the code don't work. Has anybody had this problem and could point me in the right direction?


You'll want to use "ToggleSelect" for the second and subsequent lines.

-Rob