| View previous topic :: View next topic |
| Author |
Message |
jedd General User

Joined: 13 Jan 2009 Posts: 7
|
Posted: Thu Apr 08, 2010 12:17 pm Post subject: linking to external files |
|
|
Hi all,
I'm running an academic journal and need a slightly souped up contact list application. My main tasks are organizing mailing lists of our subscribers, invoices, payments, correspondence, etc.
I already have a spreadsheet that is our contact list. This imports great into Base... no issue there. But I would like to be able to create links to external pdf files. As I send invoices and receive payments, in addition to notating such in a table, I want to be able to link to pdfs of invoice and checks for verification purposes. Ideally in a form I would be able to navigate the data in the Base tables as well as clicking on links to pdfs via push button or hyperlink, or something. I've been reading the help files. I've found information on hyperlinks, but the directions are rather vague and unhelpful. The directions refer to inserting a link into a document (is this a table or form?). I assume that such links would be made in the table which gets referenced from a form, rather than inserting a link in a form. Could some one explain conceptually where I should be trying to insert links. Each record (row of the table) will have a couple of external files I want to navigate to through links of some sort. I am envisioning that clicking a link automatically opens a pdf in Adobe Reader.
Another question I have is how to do a more "forgiving" search. As my db currently stands, filtering for "Stanford" comes up empty, but "Stanford University" brings up the record I want. How do I set the filter for a conceptual "must contain" rather than "contains only?"
Thanks for any thoughts |
|
| Back to top |
|
 |
RPG Super User

Joined: 24 Apr 2008 Posts: 2696 Location: Apeldoorn, Netherland
|
Posted: Thu Apr 08, 2010 2:14 pm Post subject: |
|
|
Hello
for your first question this can help.
| Code: | REM ***** BASIC *****
' You need two controls in your form(document). They must be in the same form(as in navigator).
' One control is a text control and contains the pathname or url to the file.
' The second control is a button.
' The action is bound to the first event of the button control: Before commencing.
' The function can be aborted when the files does not exist.
' You have also change the properties of the button control.
' The action is :Open document/webpage.
' The small macro move the field value from the textbox to the button control url
function openurl(oEv as object)
'
dim oForm,oTextBox
oForm=oEv.source.model.parent
oTextBox=oForm.getbyname("TextBox")
if FileExists ( oTextBox.text) then
oEv.source.model.targeturl=oTextBox.text
openurl=true ' Do the programm when the file exists
else
openurl=false ' The file does not exist and do nothing
end if
'print convertfromurl(oTextBox.text)
End function |
Your second question use a query like this
select * form "mytable" where "name" like '%name%'
I hope this helps.
I have edit a typo
Romke
Last edited by RPG on Mon Sep 13, 2010 9:11 am; edited 1 time in total |
|
| Back to top |
|
 |
jedd General User

Joined: 13 Jan 2009 Posts: 7
|
Posted: Sat Apr 10, 2010 5:28 am Post subject: |
|
|
Hi RPG
Thanks for the reply. The logic makes sense to me, but I'm still having trouble with the execution.
Here's what I did
1. I cut and pasted your code into my OO macros
In Edit Form mode
2. created push button on my form labeled "Lackeys Log"
3. ceated text box with the name Text Box
4. Right Click on push button > Control
5. In the tab labeled Events, in first action window (labeled Approve Action), assigned the macro
6. Save Form and exit
Then I open the form
My initial thought was that I could put the cursor in the text box and insert hyperlink, but in that mode the hyperlink tool isn't available and there are no hyperlinks listed in Navigator. In Edit mode I also right clicked the text box > control looking for some place to add a path, but I didn't find anything. How am I supposed to insert the path?
I fiddled a little further...
Back in Edit mode, the insert hyperlink tool is available. I thought I could highlight the text box, and insert hyperlink. When I did this a dialogue box appeared and I made the link. I thought the link would show up in the text box, but a hyperlink was created at the top of my form. But that link also showed up in Navigator.
So then I went back to Open form mode and dragged the hyperlink from Navigator into the text box. It worked!! The location of my file showed up in the textbox. The hyperlink also shows up as text at the top of my form.
Then I tried pressing the push button which should make the hyperlink work. That produced an error message
Basic Runtime error
an Exception occurred
Type: com.sun.star.container.NoSuchElementException
Message: .
Jedd |
|
| Back to top |
|
 |
dacm Super User


Joined: 07 Jan 2010 Posts: 734
|
Posted: Sat Apr 10, 2010 8:58 am Post subject: |
|
|
quick note:
openur=true
is probably:
openurl=true |
|
| Back to top |
|
 |
RPG Super User

Joined: 24 Apr 2008 Posts: 2696 Location: Apeldoorn, Netherland
|
Posted: Sat Apr 10, 2010 10:09 am Post subject: |
|
|
Hello
Here is the same code. And dacm was right there was an little error in the code.
I change the typo later but not complete.
I did assume you have a list with url and need only to execute it.
Now I have made a little sub for moving a value from a file select control to a text box.
I have test it and it is working for me on this moment
Romke
This means all
a) one textbox control
b) One Button for executing the url
c) One control for selecting a file
d) One control button for moving the file name.
I think this are a lot of controls but on this moment I don't have a better solution
Romke
| Code: | REM ***** BASIC *****
' You need two controls in your form. They must be in the same form.
' One control is a text control and contains the pathname or url to the file.
' The second control is a button.
' The action is bound to the first event of the button control: Before commencing.
' The function can be aborted when the files does not exist.
' You have also change the properties of the button control.
' The action is :Opem document/webpage.
' The small macro move the field value from the textbox to the button control url
function openurl(oEv as object)
dim oForm,oTextBox
oForm=oEv.source.model.parent
oTextBox=oForm.getbyname("TextBox")
if FileExists ( oTextBox.text) then
oEv.source.model.targeturl=oTextBox.text
openurl=true ' Do the programm when the file exists
else
openurl=false ' The file does not exist and do nothing
end if
End function
Sub movename (oev as object)
' Bind this to a button for moving from the file select control to the rtext box
' When text changed
dim oFilepicker,oTextbox,oForm
oForm=oev.source.model.parent
oFilepicker=oForm.getbyname("File Selection 1")
oTextbox=oForm.getbyname("TextBox")
oTextbox.text=converttourl(oFilepicker.text)
oTextbox.commit
oFilepicker.text="/home/romgro/Documents" ' You can give an other value
end sub |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|