Home

Cardbox Talk

 

CardboxForumsCardbox Talk > "Naming images within a Cardbox field"

Naming images within a Cardbox field

Current user: [none]
Register / Log In · Help

Posted By Post

Juan

23-Nov-2009 13:52

My database contains fields with images, word docs and PDF´s. As a result some of the fields contain a number of different such objects.
Is there a way to know what each object contains, without having to open them?
Can each be named within the image field?

Jelly Belly

23-Nov-2009 15:35

I had exactly the same problem and have managed to come up with a solution. It may be not be the slickest ever programming as I am new to Vbscript. Basically when you save a record the macro reads the image field and writes the contents into a text field(s). There is also a mechanism to remove the text when a file is deleted. If you want some more info or screenshots, let me have your e-mail.

EditRecord

Dim MyPath,MyFile,RevPath,RevFile
Dim img,count

count = 1

For Each img In ActiveRecord.Images
If Fields("TECH_NOTE1") <> "" Then
MyPath = img.OriginalFileName
RevPath = StrReverse(MyPath)
RevFile = Split(RevPath,"\",-1)
MyFile = StrReverse(RevFile (0))
End If

If count = 1 then Fields("TECH_NOTE1_TEXT").Text="1) " & MyFile
If count = 2 then Fields("TECH_NOTE2_TEXT").Text="2) " & MyFile
If count = 3 then Fields("TECH_NOTE3_TEXT").Text="3) " & MyFile
If count = 4 then Fields("TECH_NOTE3_TEXT").Text="4) " & MyFile

count = count + 1
Next

If Fields("TECH_NOTE1") = "" Then
Fields("TECH_NOTE1_TEXT").Text=""
Fields("TECH_NOTE2_TEXT").Text=""
Fields("TECH_NOTE3_TEXT").Text=""
Fields("TECH_NOTE4_TEXT").Text=""

End if

If count = 2 then
Fields("TECH_NOTE2_TEXT").Text=""
Fields("TECH_NOTE3_TEXT").Text=""
Fields("TECH_NOTE4_TEXT").Text=""
End if

If count = 3 then
Fields("TECH_NOTE3_TEXT").Text=""
Fields("TECH_NOTE4_TEXT").Text=""
End if

If count = 4 then
Fields("TECH_NOTE4_TEXT").Text=""
End if

SaveRecord

bert

23-Nov-2009 16:31

Hi,
As far as I understand you ask two things:
1.You want to know which text in which file is stored in the image field?
2.Can I give a name to each object in the image field?

My question then is: What is the reason to store in this case more than one object into an image field?
Why you make not one record for each file and copy the text of that record into a normal text field?
Then it's also easy to search.

I do that b.e. with Outlook email. Every email is separate saved as msg file an read into an image field (by a script of course). The body text as well as to, cc, bcc, subject + name of attachments are stored in Cardbox text fields. One click an the msg is back on screen again (and if needed with a second click back into your Outlook environment).

Regards
Bert

Juan

25-Nov-2009 11:56

Bert thank you. Not even sideways thinking. What comes to mind is I couldn´t see the wood for the trees.
Your suggestion is of course easy and direct.
I had different documents and photos relating to a subject in one field. I shall see if I can now export them each to a different record.
My thanks also to Jelly Belly. However I am not a programmer and I would be flying blind.

Quick Reply

Please log in or register before trying to post a reply.

 
© 2010 Cardbox Software Limited   Home