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'),'');
&'-'& num(num#(mid(objectSID,1,2),'(HEX)'),'0') // Revision Level
&'-'& num(num#(mid(objectSID,5,12),'(HEX)'),'0') // Authority
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.
Do you have any idea? It seems weird to me that how is this working
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.
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:
upper(SAMAccountName) as SAMACCOUNTNAME,
HexStrToDecStr(objectSID) as SID,
mid(subfield(DistinguishedName,',',-3),4) as OU1,...
"HexStrToDecStr" is an invalid function.
used this piece of VB code in Macro and calling the same from the script
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.