Macro to Autoload Image URL per Field Text?

Discuss the database features

Macro to Autoload Image URL per Field Text?

Postby sdritchey » Tue Jun 09, 2009 7:02 pm

Hello all,

I'm looking to write a macro to autoload an image into a field based on the text in another field. To be more specific:

I have a plant ID database with scientific name, and a bunch of other information. I also have a folder with several images of each plant. The image files are named by the scientific name 1, scientific name 2, scientific name 3, etc. When I load the record I want the image fields to automatically look for the image file in a specified folder using the scientific name field as the first part of the file path, and then adding a 1, 2, or 3...

Could anyone break this macro down for a beginner like myself?

Or is it possible to do this by placing a URL path in the "default value" that somehow references the scientific name field and skip the macro?

Thanks,
Steve
OOo 3.1.X on Ms Windows XP
sdritchey
 
Posts: 7
Joined: Wed May 27, 2009 10:41 pm

Re: Macro to Autoload Image URL per Field Text?

Postby TheGurkha » Tue Jun 09, 2009 10:08 pm

Does this help: how to add images to base, with and without using path.

If this has answered your question please go to your first post and use the Edit button, and add [Solved] to the start of the title. You can use the green tick icon at the same time if you like.
Ubuntu 13.04 Raring ringtail, LibO 4.0.2.2 (Build ID 400m0 (Build:2))
Gurkha Welfare Trust
User avatar
TheGurkha
Moderator
 
Posts: 6426
Joined: Thu Mar 13, 2008 12:13 pm
Location: North Wales, UK.

Re: Macro to Autoload Image URL per Field Text?

Postby sdritchey » Tue Jun 09, 2009 11:31 pm

Hi Gurkha,

I was looking at that before I posted, but there's 2 things. Those macros were written before the 3.1 update, and now with 3.1 I can have a text field that stores the path and retrieves the images without the macro (scroll down to the bottom of the thread). I've got that up and running no problem. The other thing missing from that macro is the part that retrieves the text from the "scientific name" field and pastes that into the file path.

Thanks for the help,
Steve
OOo 3.1.X on Ms Windows XP
sdritchey
 
Posts: 7
Joined: Wed May 27, 2009 10:41 pm

Re: Macro to Autoload Image URL per Field Text?

Postby TheGurkha » Tue Jun 09, 2009 11:37 pm

I'm afraid I can't help further. Hopefully someone more experienced in this will come through this thread soon.
Ubuntu 13.04 Raring ringtail, LibO 4.0.2.2 (Build ID 400m0 (Build:2))
Gurkha Welfare Trust
User avatar
TheGurkha
Moderator
 
Posts: 6426
Joined: Thu Mar 13, 2008 12:13 pm
Location: North Wales, UK.

Re: Macro to Autoload Image URL per Field Text?

Postby Villeroy » Sun Jun 21, 2009 10:32 am

http://development.openoffice.org/releases/3.1.0.html
image controls: can be bound to text database columns, interpreting their content as relative link to the image i91310 feature-info:
Image controls in database forms can now be bound to text columns. Formerly, you could only bind them to columns whose content could reasonably be interpreted as binary (BLOB etc.). Now, when you select a text database column as source for the image control, then it will interpret the content of the respective column's content as URL, and load and display the image pointed to by this URL. Also, the URL might be relative to the document which the image control is embedded into.


Seemingly, the developers did not change the way how binary data (such as pictures) are handled. They just modified the image control to accept a text field. The text field is supposed to contain URLs as a pointer to picture files outside the database, relative to the Base document's path.
pics/holyday/beach.png
pics/dog/shit.bmp
pics/cat/scratch.jpg
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 12.04, Apache OpenOffice 4.x
User avatar
Villeroy
Volunteer
 
Posts: 17278
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macro to Autoload Image URL per Field Text?

Postby RPG » Sun Jun 21, 2009 12:26 pm

hello

I was looking at that before I posted, but there's 2 things. Those macros were written before the 3.1 update, and now with 3.1 I can have a text field that stores the path and retrieves the images without the macro (scroll down to the bottom of the thread). I've got that up and running no problem. The other thing missing from that macro is the part that retrieves the text from the "scientific name" field and pastes that into the file path.


You have only to point the data field from your image control to the field of your table which kept the name of the file. I knew people love macros but i"m afraid you can not use them in this case.

This all if I understand you correct.
Romke
openSuse version of LibreOffice 4.1.5.3 stable on openSUSE 12.2
RPG
Volunteer
 
Posts: 1548
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands


Return to Base

Who is online

Users browsing this forum: No registered users and 3 guests