Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

Not applicable

Re: docprop.Script macro

Hi Celambarsan Adhimulam,

superb, It is working perfectly.

I really thank you a lot on sharing your knowledge and spending your valuable time with me.

Regards,

Venkat

docprop.Script macro

Hi,

     One more thing i noticed in that every it adds one extra line in all the tabs did you checked that?.Will work on it and after the change post you again.

Celambarasan

docprop.Script macro

Hi,

     Use the code below

sub AddScript

docprop=Activedocument.GetProperties

ArrayScript = split(docprop.Script,"///$tab ")

For i=1 to Ubound(ArrayScript)

if(Left(Trim(ArrayScript(i)),Len("Main 2"))="Main 2") then

          ArrayTabScript=Split(ArrayScript(i),Chr(10))

          if(Ubound(ArrayTabScript)>=4) then

                    ArrayTabScript(4)= "$(Include=d:\vqd eat\text\test.txt);"

                    ArrayScript(i)=Join(ArrayTabScript,Chr(10))

          else

                    Dim ArrayTempScript(3)

                    For j=0 to Ubound(ArrayTabScript)

                              ArrayTempScript(j)=ArrayTabScript(j)

                    next

                    for j=Ubound(ArrayTabScript)+1 to 3

                              if(j = 3) then

                                        ArrayTempScript(j)= "$(Include=d:\vqd eat\text\test.txt);"

                              else

                                        ArrayTempScript(j)=chr(10)

                              end if

                    next

                    ArrayScript(i) = Join(ArrayTempScript,Chr(10))

          end if

          exit for

end if

next

docprop.Script = "///$tab " & ArrayScript(1)

For i=2 to Ubound(ArrayScript)

docprop.Script = RemoveLastLine(docprop.Script)

docprop.Script = docprop.Script& Chr(10)  &"///$tab " & ArrayScript(i)

next

Activedocument.SetProperties docprop

end sub

 

function RemoveLastLine (Script)

SplitArray=split(Script,Chr(10))

RemoveLastLine=SplitArray(0)

for i=1 to ubound(SplitArray)-1

          RemoveLastLine=RemoveLastLine&Chr(10)&SplitArray(i)

next

j=ubound(SplitArray)

if(len(SplitArray(j))>0) then

          RemoveLastLine=RemoveLastLine&Chr(10)&SplitArray(j)

end if

end function

Celambarasan