Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

current selection issue

Hello All

I have a request to scramble a spastic field in the model - i found a code where u keep moving 2 digits around and multiple them and i got a scrambled field

The problem is that i cant do it in the script and in the Current selection i can see the original field

any way to scramble the current field also in the current selection ???

thanks

J

5 Replies
swuehl
MVP
MVP

Would be helpful if you could describe your issue in more detail, how your data looks right now, how you want it to look, what code you have used so far, where this used code fails to work etc.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

An easy way to scramble a field in the script is with the Hash function.

Hash128(myfield) as myfield

If you want to maintain the same length for the scrambled field:

left(hash256(myfield),lenmyfield)) as myfield

That assumes the string being translated is no longer than 32 characters -- which is the length of the string returned by Hash256.

-Rob

Anonymous
Not applicable
Author

Thanks Rob


But i need to scramble the field post reload, I need to check if the OSuser has privilege to see the information if not i need to scramble the field.

I thought of doing it with a macro that checks which OSuser has opened the model and if he has the privilege to see the info , something like this

If (user has privilege) then

     ActiveDocument.ScrambleField "MM",false
Else
ActiveDocument.ScrambleField "MM",true
End If

The thing is I keep on getting a scrambled field not sure I wrote the VB command correctly does false mean don’t scramble and true means scramble ( I’m new in the VB script )

Many thanks

J

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The API doc says the second parm should always be false. If don't want to scramble for a particular user, don't invoke the ScrambleField at all for that user.

-Rob

SunilChauhan
Champion
Champion

i thing whaterver formula you are using

you should use in variable

i mean define variable in script and use that variable with $(Variable) @ front end

hope tha might helps

Sunil Chauhan