Qlik Community

QlikView Documents

Documents for QlikView related information.

Retrieving QlikView LEF for multiples licences

lucpechali
New Contributor II

Retrieving QlikView LEF for multiples licences

Hello,

The advantage of this script is that it takes care about all types of licenses and all possible values.

Unfortunately, you can not automate everything. But you can manage your licenses later and know the state of your licenses Park.

In the manuallef site (Manual LEF), a checksum (in red below) is generated automatically for each request LEF. However, this number is still the same. I asked Qlik to know how it is generate but no answer at this moment

So just pick the url generated during the retrieving and save it in a file to be able to reuse it. To do this, press Ctrl + Shift + i in Chrome for instance and retrieve complete url after src = .

In the script below, the retrieve url is in an inline table :

Licences:

Load * inline [

Num,Url

xxxx-xxxx-xxxx-xxxx, http://lef1.qliktech.com/lefupdate/update_lef.asp?serial=XXXX%20XXXX%20XXXX%20XXXX&user=http%3A//lef...XXXXX

];

Let a=FieldValueCount('Url');

  FOR i=1 to '$(a)'

  let z=FieldValue('Url','$(i)');

  T1:

  GENERIC Load KEY,

  SubField(LEF_COR,';',1) as FIELDNAME,

  SubField(LEF_COR,';',2) as VALUES;

  LOAD replace(mid('$(z)',58,25),'%20','') as KEY,

  if(left([@1:n],1)='|','ETAT;Inactive',

  if(left([@1:n],5)='TIMEL','TIMELIMIT;' & SubField([@1:n],';',4),

  if(left([@1:n],8)='PRODUCTL','PRODUCTLEVEL;' & SubField([@1:n],';',4),

  if(index([@1:n],';')=0,

  if(index([@1:n],'-')=0,if(iterno()=1,'LICENCE;' & [@1:n],'ETAT;Active'),'CODE;'& [@1:n]),[@1:n])))) as LEF_COR,

  [@1:n] as LEF

  FROM [$(z)](fix, codepage is 1252) while iterno()<=if(len(KeepChar([@1:n],'0123456789'))=16,2,1);

  NEXT

Hope it helps.

Best regards

Attachments
Comments
lucpechali
New Contributor II

And, with the same field "url", you can call a macro that will retrieve automatically your LEF in an Text object.

Make first two variables :

     vXMLReceived

     vXML Sent

Here is the macro I use :

function httpGet()

  Set val=ActiveDocument.Fields("Url").GetPossibleValues

  vURL = val.Item(0).Text

  'Create xmlhttp opject

  Set xmlhttp = CreateObject("Microsoft.XMLHTTP")

  xmlhttp.open "GET", vURL, false

    xmlhttp.setRequestHeader "Content-Type", "text/xml"

  xmlhttp.send ""

  result = xmlhttp.responseText

  result = replace(result, "&gt;", ">")

  result = replace(result, "&lt;", "<")

  set txt = ActiveDocument.Variables("vXMLReceived")

  txt.setContent result, true

end function

Then, make a button which call your macro

And make an Text object  with =vXMLReceived

That's it

konrad_mattheis
Contributor III

Hi Luc,

you can calculate the Checksum in QlikScript and also the full URL.

This is possible :-)

For what you need the Macro?

bye

Konrad

Not applicable

Hi Konrad,

I tried to do it in the script but no success. I didn't know how to calculate this CheckSum automatically.

If you have the rule to calculat it, please share...

I just need the macro to get back just one lef manually directly in the IHM.

Bye

Luc

konrad_mattheis
Contributor III

Hi Luc,

you will find the way how to calculate somethere in the website, where you request the lefs.

bye

Konrad

lucpechali
New Contributor II

Unfortunately, no. I asked Qlik for this but they cannot answer me on this point.

Version history
Revision #:
1 of 1
Last update:
‎07-30-2015 06:37 AM
Updated by: