Hello all…
ok this is driving me nuts!
i have a form - with 5 RichText fields on it…
each RT field MAY have an attachment in it.
now, as this is being viewed on the web i need to pass the name of the attachment(s) to hidden fields - so i can then create web links from them.
i can get the field’s attachment names to be pulled accross to hidden fields BUT i cannot get them to be cleared when the document changes and an attachment is removed…
the problem seems to be i cant find a way to see if the field has an attachment… this then causes the script to fail
any ideas?..
a snippet:
Set ThisDoc = Source.Document
Set pdf = ThisDoc.GetFirstItem(“PricingAttach”)
If ( pdf.Type = RICHTEXT ) Then
Forall o In pdf.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
ThisDoc.bPricingAttach = o.Source
End If
End Forall
Else
ThisDoc.bPricingAttach = ""
End If
Subject: how can i get field attachment details?
I’m using this method to create web links on the fly to all the files contained
in a document.
Have a table like
ATTACHMENTS
Path:   Upload
Control
Code for the Computed Value:
@If( @AttachmentNames = “”; “”;
“<OL TYPE="l">” +
@Implode( @Explode( “
A HREF='/” + @Subset(@DbName; -1) +
“/OrdersSAVorderno/” + @Text( @DocumentUniqueID ) + “/$File/” +
@AttachmentNames +
“?OpenElement’ TARGET= '” + @AttachmentNames + “'> ” + @AttachmentNames +
“” + “  (” + @Text( @Round( @AttachmentLengths / 1000 ) ) +
“k) ]”; “,” ); “
” ) +
“” )
HTH
Subject: RE: how can i get field attachment details?
thanks for that but your system is much more simple than mine 
i need to know the names of each file and a reference - for example when just displaying certain files.
your method can only list all the attachments…
the problem i am having is that i can attach the files fine and on querysave i write each RT field’s attachment name to a field.
this works ok, until someone deletes the attachment (they are optional) i cannot find a way to see if a field has an attachment.
i need a way to read the ‘embeddedobjects’ when it is blank!
Subject: how can i get field attachment details?
fixed now…
If ( pdf.Type = RICHTEXT ) Then
If Isarray(pdf.embeddedobjects) Then
Forall o In pdf.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
ThisDoc.bPricingAttach = o.Source
End If
End Forall
Else
ThisDoc.bPricingAttach = ""
End If
End If
it needed to be on queryclose… as at querysave the item wasnt classed as an array yet!