Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all
I am stuck in a v.simple problem . I am not able to pass multiple variables through qvp.
set Shell = createobject("wscript.shell")
Shell.Run
"iexplore qvp://servername/Dashboards/rma1.qvw?values=Email Security & catvalue=HIGH-END HW"
full code is like this , i am writting a macro and firing tha on a button click :
sub
set
doc = ActiveDocument
set
App = Doc.GetApplication
set
values=Doc.Fields("LOB").GetSelectedValues
set
values=doc.Fields("LOB").GetPossibleValues
set
v = ActiveDocument.GetVariable("values")
MsgBox
(v.GetContent. String)
set
Shell = createobject("wscript.shell")
"iexplore qvp://serveranme/Dashboards/rma1.qvw?values=Email Security & catvalue=HIGH-END HW"
end
sub
Any help !!
Thanks
Preena
Hi All !
Following is the code that i used to pass multiple selections in multiple parameters to another report :
In the base report : (need to declare all th evariables used to pass as parameter):
rptypeval = ActiveDocument.Evaluate("concat(DISTINCT ReportType, ',')")
set v8=ActiveDocument.Fields("ReportType").GetSelectedValues
urlpart = " "
if (v8.Count > 0) then
urlpart = urlpart & "&rptypeval=" & rptypeval //In case more than one paramters,
end if used switch here and concat the url
set Shell = createobject("wscript.shell")
Shell.Run "iexplore qvp://servername/foldername/rma1.qvw?" & urlpart
Apart from this , set Macro Ssecurity level set to "Allow System Access"
Then in rma1.qvw:
set v=ActiveDocument.GetVariable("rptypeval")
valarray = split(v.GetContent.String,",",-1,1)
i=0
for i=Lbound(valarray) to UBound(valarray)
if(i=0)then
ActiveDocument.Fields("ReportType").Select valarray(i)
else
ActiveDocument.Fields("ReportType").toggleSelect valarray(i)
end if
next
Call this in macro on load .
Cheers!!
Preena
In your rma1.qvw, do you have the variables 'values' and 'catvalue' defined? I think it is also case sensitive.
Regards,
Gordon
In addition to the requirement that variables be predefined, you'll also have to encode any spaces in the url. The correct syntax would be:
"iexplore qvp://servername/Dashboards/rma1.qvw?values=Email%20Security&catvalue=HIGH-END%20HW"
-Rob
Hi rob , gordon !!
Thanks for your reply ! i have declared the two variables in my rma1 report and have hardcoded like specified. it worked. i am still left with two more issues: if you can see in my base report code i have put a msgbox to get the selection values of LOB list box which i am still not able to . Is this because of spaces in between the selected text .? Do i need to put %20 in the selected text if it contains spaces. My motive is to pass the selected items of lob and catvalue list box to rma1 report , they can be multiple selections also .
Will be really very thankful to you !!
Thanks
Preena
I dont know the answer to your question but looking at your code (this forum really doesnt seem to like pasted code does it?) your second 'set values' would seem to replace the contents of the first.
Regards,
Gordon
Hi gordon
Here is my latest code(Apolozies for the last pasted one!) :
In base report macro :
set doc = ActiveDocument
set App = doc.GetApplication
set values=doc.fields("LOB").GetSelectedValues
set values=doc.fields("LOB").GetPossibleValues
set v = ActiveDocument.GetVariable("values")
MsgBox(v.GetContent.String)
set values=doc.fields("Product Category").GetSelectedValues
set values=doc.fields("Product Category").GetPossibleValues
set Shell = createobject("wscript.shell")
Shell.Run "iexplore qvp://servername/Dashboards/rma_closed1.qvw?values="v"&catvalue="v // Problem is here when i am trying to pass the variable selection .
In rma1 report macro:
Sub onload
set v=ActiveDocument.GetVariable("values")
Msgbox(v.GetContent.String)
ActiveDocument.Fields("LOB").Select ActiveDocument.GetVariable( "values" ).GetContent.String
set v1=ActiveDocument.GetVariable("catvalue")
Msgbox(v1.GetContent.String)
ActiveDocument.Fields("Product Category").Select ActiveDocument.GetVariable( "catvalue" ).GetContent.String
End Sub
Thanks
Preena
Hi gordon, rob !!
One good news ! i am able to send two parameters with single values from my base report to rma1 . Here is the code of my base report:
sub ChooseCurrentSelect
set doc = ActiveDocument
set App = doc.GetApplication
set values=doc.fields("LOB").GetSelectedValues
set v = ActiveDocument.GetVariable("values")
for i=0 to values.count-1
MsgBox(values.item(i).text)
next
set prdvalues=doc.fields("Product Category").GetSelectedValues
set Shell = createobject("wscript.shell")
Shell.Run "iexplore qvp://servername/Dashboards/rma_closed1.qvw?values=" & values.item(0).text & "&catvalue=" & prdvalues.item(0).text
end sub
and the code written in rma1 macro is :
Sub onload
set v=ActiveDocument.GetVariable("values")
Msgbox(v.GetContent.String)
ActiveDocument.Fields("LOB").Select ActiveDocument.GetVariable( "values" ).GetContent.String
set c=ActiveDocument.GetVariable("catvalue")
Msgbox(c.GetContent.String)
ActiveDocument.Fields("Product Category").Select ActiveDocument.GetVariable( "catvalue" ).GetContent.String
End Sub
Now the thing left is to pass multiple values for each parameter: lob and product category.
Thanks!!
Preena
Hi
I am getting object required error: Object required: '[string: "abcd"]' when i trying to execute the following code :
sub ChooseCurrentSelect
set doc = ActiveDocument
set App = doc.GetApplication
set lobvalues=doc.fields("LOB").GetSelectedValues
set values = lobvalues.item(0).text // Error is coming for this line
for i=0 to lobvalues.count-1
MsgBox(lobvalues.item(i).text)
set values = values & "," & lobvalues.item(i).text
next
set prdcatvalues=doc.fields("Product Category").GetSelectedValues
set prdvalues = prdcatvalues.item(0).text
for j=1 to prdcatvalues.count-1
MsgBox(prdcatvalues.item(j).text)
set prdvalues = prdvalues & "," & prdcatvalues.item(j).text
next
set Shell = createobject("wscript.shell")
Shell.Run "iexplore qvp://servername/Dashboards/rma_closed1.qvw?values=" & values & "&catvalue=" & prdvalues
end sub
I am trying to concatenate all the selected values of lob list box into variable value separated by comma(,) and then in rma 1 i will split the string according to , and will bind as selection. Any clues for the error?
WIll be thankful to your help !!
Thanks
Preena
You are getting the object required error because the set statement expects an object, and the .Text members you are dealing with are strings.
But forget about the for loop. With a single line you can build a comma seperated list of values using QV concat().
values = ActiveDocument.Evaluate("concat(DISTINCT LOB, ',')")
-Rob
Thanks rob !!, Thanks gordon !!
I am able to do that.
Soon i will upload the latest code here.
Cheers!!
Preena