Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a piece of code for the identification of QlikView_admins:
- In each of my apps, there are some objects relevant for development, but not for the users (like some rulers and textboxes with comments)
=> These are all governed by a variable v_Dev (a binary variable, it is 1 or -1)
=> This variable is switched by a button
=> That button, in turn, is visible only to the admins - currently two people.
=> To avoid great effort at a later time, I have, instead of hard-coding our names in that button, listed them in an Excel_file
=> Since OSUSER() will normally not work (all the reloads are done by the server, by a server_user, not by us), I have developed
a piece of code for partial_reload that we can then run and QlikViiew will identify us as admins and the button will appear.
I have a problem in that code. I will post it here.
// Erst mal werden aus einer Excel-Übersicht, die zu dem Zweck angelegt wurde,
// die Namen aller QlikView-Admins geladen, denen die entwicklungsrelevanten
// Objekte zur Verfügung stehen sollen.
// Diese Tabellen werden bei einem Partial_Reload geladen (mit Ctrl+Shift+R),
// bei dem sonst nichts geladen oder verändert wird.
Replace
Developers_pre:
LOAD
OSU,
IF(OSUSER()=OSU, 1, 0) as Admin_logged_on
;
LOAD
Recno() as Line_ID_Admin,
Domain,
Name,
(Upper(Domain) & '\' & Lower(Name)) as OSU
FROM
[\\rgb1app202\production\99_Resources\Wichtig_nicht_löschen\QlikView_Admins.xl*]
(ooxml, embedded labels, table is Names);
NoConcatenate
Admin_identification:
Replace
LOAD
sum(Admin_logged_on) as Admin_yn
RESIDENT Developers_pre
;
DROP TABLE Developers_pre;
That's it. The tables are loaded also when the reload is done as usual on the server, but then that resulting field > Admin_yn < is 0, so that button is not visible.
Due to that keyword "Replace", I would expect that when I open the app and trigger a partial_reload (Ctrl+Shift+R), both the tables will be replaced
by new ones and the field will be 1.
Instead I suddenly get 2 records in that resulting table !?
Please give me some advice here. It's the 1st time that I work with the partial_reload.
Thanks a lot!
Best regards,
DataNibbler
Hello,
Why don't you try try section access?
You can apply that to a ROLE table. We generally use that technique for sheet authorization.
BR
Serhan
Thanks!
I might consider that when I see this doesn't work.
At the moment, though, it does seem to work. Seems QlikView couldn't deal with a preceding_load for that partial_reload.
I have just incorporated that additional code into the primary LOAD, making it a bit more complicated, and I have added a FIRST 1 statement to my last LOAD to make sure only one record is loaded.
Let's see.
O_O - there comes trouble again ...
I have tested in in a small template_app and I thought it was all right - but there I had an EXIT SCRIPT right after that piece of code.
Now I am testing that code in one of our live_apps. There is no EXIT here, but in a partial_reload, QlikView should only reload the tables with the keywords >Add< or >Replace< in front of the LOAD, no?
<=> Well, it seems QlikView is instead trying to reload it all and of course there are errors.
P.S.: The place in the script where an error occurs is a FOR...NEXT loop. It's in our master_calendar, so I am positively sure that it works. I don't know why the partial_reload encompasses this?
Now I have tried something else:
Since it seems that QlikView, in spite of the partial_reload, tries to execute the rest of the script, I wanted to introduce an IF_THEN clause with an EXIT command. I tried to use the flag_field >> Admin_yn << I had just created to avoid starting all over again by using OSUSER() - but that did not work at all. QlikView ignored it and just went straight up to the regular EXIT tab.
I give it up - for now.
The partial_reload just does not seem to work reliably and as expected: I was expecting QlikView to reload ONLY the tables I had marked for a partial_reload, nothing else.
<=> Instead, QlikView seems to load these tables, then skip some others and then try to execute some loop or JOIN - it seems the partial_reload is not strictly limited to the LOAD_statements flagged with the keywords >Add< and >Replace< as is stated in the manual.
Best regards,
DataNibbler