Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I'm trying to achieve a simple functionality using extensions. My requirement is to export list box data to excel using extensions and I should not use built in export option or macro.
In Javascript API's, I found a class "Qv.CustomIcons" which is having the parameter "XL"(Send to excel) but don't know how to use this in extension.
I have attached the API page for reference. It would be of great help if you can provide any ideas to achieve this.
Hello,
I am not sure that all the JavaScript code can be used by an extension. For example if you look here:
You get told when the call can be made by the extension (in the Note section)... I don't think you can assume that all JavaScript can be used by extension.
Also mostly extensions are to do something "different" (i.e. put your data over a Google map etc).
If you wanted to export list box data you would generally just tick the "Send to Excel" option on the "Caption" tab of the list box in question. Is there a reason you are not using this option?
Yet if you are not using this option I suspect you are trying to automate something or do something different from a the straight export mentioned above.
Further to this... off the top of my head... given that the extension takes the data passed in could you not just create JavaScript to create a CSV file which could then be opened by Excel?
Hi Tyrone,
Thanks for your reply.
I will explain the complete requirement scenario. There will be a dashboard where user makes some selections in the list box and I have to store these selections in excel file (which has to be stored in a common folder) . This excel file should be accessible to other user who can see this data.
I shouldn't use macro for this, so I'm trying to do this using extensions.
Hi,
There is nothing that you have written here that makes me think you need to use an Extension... I am NOT a QV Pro so sorry if I am incorrect.... but I would have thought you could write the JavaScript to do this and place it behind a button and call it as a macro.
You can probably use the calls above (etc) within QV a lot easier as well.
I am back to the question does it have to be an Excel file or a file that Excel can open?
Hi Adarsha,
Try this code
Qva.AddExtension('ExcelExtension', function(){
var exportObjectId = "LB02";
var html = "<button type=\"button\" onclick=\"sendRequest('" + exportObjectId + "');\">Button</button>";
_this.Element.innerHTML = html;
});
function sendRequest(tblId) {
//getQvFramId
var targetName = tblId;
var mgrObj = qva.Managers;
var qvObjectFramId;
var qvObjectFramName;
for (i = 0; i < mgrObj.length; i++) {
if (mgrObj.Element) {
elmt = mgrObj.Element;
var _TargetName = elmt.TargetName;
if(_TargetName != null){
var targetName1 = "Document\\" + targetName;
var targetName2 = "Server\\" + targetName;
if (_TargetName == targetName1 || _TargetName == targetName2 || _TargetName == targetName) {
qvObjectFramId = elmt.ObjectId;
qvObjectFramName = elmt.Name;
break;
}
}
}
}
mgrObj = [];
var clientsizeWH = Qva.GetViewportWidth() + ':' + Qva.GetViewportHeight();
if(qvObjectFramId != null){
sendRequestBody(qvObjectFramName,clientsizeWH);
}
else{
alert("Object not found...!");
}
}
function sendRequestBody(qvObjectFramName,clientsizeWH){
//generate request body
var _cmds = "<set name=\"" + qvObjectFramName + ".XL\" action=\"\" clientsizeWH=\"" + clientsizeWH + "\" />"
qva.Body = _cmds;
qva.Send();
}
Hi,
I cannot use Macro because of the client requirement. They have clearly told us not to use macro and come up with some solution to achieve this so I'm trying to do this using extension.
I can store the data in text, CSV, excel or any file format that should be accessible by the other user.
Hi,
Well I am not sure how the client will allow you to use JavaScript in an Extension but will not allow you to use JavaScript in a Macro. I assume that I am missing something obvious
Anyway with the Extension you decide what data you want to send to the Extension (which is resent when the data in QV is changed). So you can just pass the field to the extension and write a loop to write the data to a file and therefore create a simple CSV file.
I don't have data to create a file via JavaScript but I am sure there is plenty of data on the web. You also might want to pass something in to the extension to let it know when it should be writing the data to the file (and when it should not).
.... still going back to the original issue of reading from listbox, I suspect the solution is to just past the listbox into the extension.
Hi Adarsh,
Did you find the extension for excel export. If so, can you please share with me. I have the same requirement.
Thanks
Neetu