Ask Your Question
0

Howto connect "file selection" button to my data table [Base form]

asked 2019-10-10 23:00:24 +0200

joppla gravatar image

Hello,

I m a little beginner in LibreOffice base. I saw that I can add a "file selection" button to a form. But how can I use this information in my form of database? For example to add the filename to the table.

Thanks for reaction

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-10-10 23:29:28 +0200

Ratslinger gravatar image

updated 2019-10-11 00:07:19 +0200

Hello,

You can use a macro to access the selected name and then do with it as you want such as continue the macro to insert into an existing field name. Sample macro:

Sub Snippet
  Dim oForm As  Object
  Dim oField As Object
  Dim sText As  String
  oForm = ThisComponent.getDrawPage().getForms().getByIndex(0)
  oField = oForm.getByName("File Selection 1")
  sText = oField.Text
End Sub

Edit:

Please be aware, the code obtains the first internal form - getByIndex(0). Also the example uses the control named File Selection 1. Adjust as needed.

edit flag offensive delete link more

Comments

Seems me reasonable, I will test your suggestion.

Is there anywhere documentation about the structure and names of all that objects?

joppla gravatar imagejoppla ( 2019-10-10 23:32:38 +0200 )edit

These two documents provide most needed information. Warning, they are not small:

http://www.pitonyak.org/OOME_3_0.pdf

http://www.pitonyak.org/database/Andr...

Ratslinger gravatar imageRatslinger ( 2019-10-10 23:59:03 +0200 )edit

@joppla,

Is this question related to the post on the Dutch forum where you ask about a macro to import an image? If so, I believe that question is not explained well enough and you may be taking a wrong direction.

If you are attempting to store the location of the image, view it but not embed it, then simply use an image control connected to a varchar field. This is linking an image. Size of the field should be 100-200 characters depending on file location.

Ratslinger gravatar imageRatslinger ( 2019-10-11 04:08:27 +0200 )edit

Yes, it is related, do you mind to continue the discussion on the Dutch forum? I don't mind to publish the solution here, but I prefer to discuss in Dutch to come to the solution.

Shall I explain my idea on the Dutch forum some better?

joppla gravatar imagejoppla ( 2019-10-11 13:12:45 +0200 )edit

Wow, the documents are pretty large. I remember from the time that I was writing VBA that there were quite sufficient help tools that show you the possible structure of the object that you was creating. It isn't in LibreOffice?

joppla gravatar imagejoppla ( 2019-10-11 13:17:18 +0200 )edit

@Ratslinger: Let's continue here

joppla gravatar imagejoppla ( 2019-10-11 14:39:27 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-10-10 23:00:24 +0200

Seen: 59 times

Last updated: Oct 11 '19