Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
The module bug aside, here is native Qlik script that will convert a hexadecimal SID to a string representation.
Set ParseSubSA = if(len($1)>$2, '-'& num(num#(mid($1,$2+6,2) & mid($1,$2+4,2) & mid($1,$2+2,2) &mid($1,$2,2),'(HEX)') ,'0'),'');
Users:
LOAD
UserName,
UserDN,
objectSID,
'S'
&'-'& num(num#(mid(objectSID,1,2),'(HEX)'),'0') // Revision Level
&'-'& num(num#(mid(objectSID,5,12),'(HEX)'),'0') // Authority
& $(ParseSubSA(objectSID,17))
& $(ParseSubSA(objectSID,25))
& $(ParseSubSA(objectSID,33))
& $(ParseSubSA(objectSID,41))
& $(ParseSubSA(objectSID,49))
& $(ParseSubSA(objectSID,57))
as StringSID
FROM ...
The script assumes a max of 6 sub authority values, if you have more just duplicate the line and add 8 to the second parameter. The ParseSA function will test the length of ObjectSID so no harm in over-defining.
-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com
Do you have any idea? It seems weird to me that how is this working
Script
Name>'$(arg)'
Logfile example
and Name>'XYZ'
Do you know what might be going on here?
I'm not absolutely sure but I think it means something like: 'a' precedes 'b' in Qlik and that SQL doesn't need an extra operator to perform a string-comparison and applies it automatically if the operands aren't numerical.
- Marcus
Nothing wrong with that loop code. I wrote it 🙂
It exits the loop fine, the problem is in the subsequent LOAD:
//************** Create a smaller list of AD groups related to BI applicationsAD_Group_Tmp:
LOAD
*,
upper(SAMAccountName) as SAMACCOUNTNAME,
HexStrToDecStr(objectSID) as SID,
mid(subfield(DistinguishedName,',',-3),4) as OU1,...
"HexStrToDecStr" is an invalid function.
-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com
Thanks Rob,
used this piece of VB code in Macro and calling the same from the script
the same HexStrToDecStr(objectSID) as SID works using manual reload while it's failing while QMC reload
I think that's a bug -- module functions not recognized -- in the server version of QV 12.30. It fails even when all the "allow macro execution on server" boxes are checked in the QMC. But it works on Desktop. I recommend you contact QT support.
-Rob