That code is all right, and that will cause that the users will be prompted for credentials when clicking on the file. But My guess is that you want to link their accounts in your domain to the section access, which is fine as well, but you need to use the field NTNAME instead of USERID/PASSWORD, and provide the list of users always using DOMAIN\USERNAME. Check among many others this thread on how to use this in Section Access and some working code.
Make sure that after making a backup of your QVW file, you check Settings menu, Document Properties, Opening tab, "Initial Reduction Based on Section Access" and "Strict Exclusion" should you want to deny access when a Supplier does not have any data related in the data model.
Hope that helps
Thanks for your quick reply. But in our case most of the suppliers are external people ( not in same domain ).
Yes, I have checked the box for "initial Reduction Based on Section Access" and "Strict Exclusion" but no luck.
Apologize but I am not sure when you say "clicking on the file" will prompt user for his credentials. Let me explain what I am doing then it would be more clearer.
1. Developed application ( charts & tabular data ) in qlikview.
2. Defined section access in hidden script. ( code as above )
3. Saved .qvd + Reload Data
4. Copy above .qvw file to Qlikview Published folder.
5. Create individual supplier account as stated in above post
6. Supplier will log in using his credentials using qlikview access point ( over the Internet )
7. After successful login, supplier should be able to see .qvw file.
8. Supplier click on .qvw file ( application is not asking for uid/pwd again ), I believe user is already authenticated in step-6
9. Supplier should be able to see only his data.
Please let me know if I am wrong in any of steps above.
Once again thanks a lot for your time on this, much appreciated.
I see all 9 steps right. Except for that the credentials the user input when prompted will not match with USERID and PASSWORD fields in Section Access, but with NTNAME, irrespective of the domain they are logging from.
So I will go back step 2 and set NTNAME instead of USERID and PASSWORD, noting that NTNAME must match the same credentials the user is going to input (for example, in case of custom directory: CUSTOM\USER1). This way, section access will work as expected: view only documents that is allowed to see, and log into the QVW documents without being prompted and only the information they are allowed to see, because of the reduction QlikView does when section access exists and the document properties are correctly set.
Besides, suppliers must have some licenses available (either Document, Named, Usage or Session) and they must be Authorized in the QMC (Documents, User Documents, Authorization tab, "Users Authorized to Access Document").
Hope that helps.