I can't quite wrap my head around where to start with this and I was hoping someone here would have a suggestion.
Here's what I've got right now:
I have a grid that contains a file location field. Within that field I have a full path and file name. I'm currently using it to download a .pdf drawing via a button and it's working fine for that.
Besides the .pdf, there are also other files in another directory that are related. These files are the actual CAD files that can only be opened with the proper CAD program. There is always a drawing file in this directory with the same name as the one in the file location field except with the extension being .slddrw instead of .pdf.
I'm able to get the .slddrw file with a little change to the file download javascript code in alpha 5. The below works:
When I use the above (basically to change the file path to the correct one) I can get my drawing file to download to my machine.
Now, here's my problem.
The drawing file is no good if I can't get the part and assembly files that may go with it. They may have the same name or they may have the same name plus "-1" or "-03" etc.
So, what I'd like to do is make some sort of function via xBasic, javascript or a combination of both that searches the directory, returns file names that might match, and then allows the user to pick which ones to download to their machine.
Let's take this example.
My file location for the .pdf file is : P:\Secured\ReleasedPDF\Tooling\060\06000.pdf (Currently, I have no problem turning that into : P:\Secured\Tooling\060\06000.slddrw)
I want to search P:\Secured\Tooling\060\ for files (to use SQL terms just for explaination) LIKE '06000%'
I want to return the results of that search to the user.
I want to then allow the user to choose among the results.
I want to then send the users choices to the users machine via download.
What do you guys think is the best/easiest way to do this?
Thanks in advance!
Here's what I've got right now:
I have a grid that contains a file location field. Within that field I have a full path and file name. I'm currently using it to download a .pdf drawing via a button and it's working fine for that.
Besides the .pdf, there are also other files in another directory that are related. These files are the actual CAD files that can only be opened with the proper CAD program. There is always a drawing file in this directory with the same name as the one in the file location field except with the extension being .slddrw instead of .pdf.
I'm able to get the .slddrw file with a little change to the file download javascript code in alpha 5. The below works:
Code:
window['{grid.componentName}_D__UNBOUND_BUTTON_4_1'] = function(rowNum,rowId,objEle) { if({grid.object}._embeddedMode) { alert('File download is not supported when the Component is running on the Desktop.'); return false; } var e = $('{grid.componentName}.__IFRAME1'); var filename = ({grid.object}.getValue('D','FILE_LOCATION',rowNum)); var testFilename = filename.split('://')[0]; var oldn = filename.split('\\').pop(); var newname = 'P:\\Secured\\Tooling\\' + oldn.substring(0,3) + '\\' + oldn.split('.').shift() + '.sldprt'; if(testFilename.toLowerCase() == 'http' || testFilename.toLowerCase == 'https') { e.src = filename; } else { filename = urlencode(newname); e.src = '__A5FileDownload.a5w?c=%5fa5filedownload&action=Display%20message&message=File%20%7bfilename%7d%20not%20found%2e&fileToDownload='+filename+''; }; }
Now, here's my problem.
The drawing file is no good if I can't get the part and assembly files that may go with it. They may have the same name or they may have the same name plus "-1" or "-03" etc.
So, what I'd like to do is make some sort of function via xBasic, javascript or a combination of both that searches the directory, returns file names that might match, and then allows the user to pick which ones to download to their machine.
Let's take this example.
My file location for the .pdf file is : P:\Secured\ReleasedPDF\Tooling\060\06000.pdf (Currently, I have no problem turning that into : P:\Secured\Tooling\060\06000.slddrw)
I want to search P:\Secured\Tooling\060\ for files (to use SQL terms just for explaination) LIKE '06000%'
I want to return the results of that search to the user.
I want to then allow the user to choose among the results.
I want to then send the users choices to the users machine via download.
What do you guys think is the best/easiest way to do this?
Thanks in advance!
Comment