Media-field with or without content ?? 
Author Message
 Media-field with or without content ??
Hy,

is there any possibility to detect via script/search wether a
media-field (image or sound) has content or not ?

Thanx!

Lothar



Tue, 10 Sep 2002 03:00:00 GMT
 Media-field with or without content ??

Does the IsEmpty(fieldname) function not work?
Quote:

> Hy,

> is there any possibility to detect via script/search wether a
> media-field (image or sound) has content or not ?

> Thanx!

> Lothar



Tue, 10 Sep 2002 03:00:00 GMT
 Media-field with or without content ??
I have a similar problem, and appreciate the tip regarding IsEmpty.  At
first I thought of making the container field calculated, but figured a
small script would be easier.  This is what I did.  If there's a simpler
or more elegant way, I'd appreciate hearing about it.

Say I have a container field called Pic that could contain anything.
There are thousands of them and i want to Find the batch that are empty.
I make a small field that could be hidden or not called Check.  I then
made this script:

Go to Record/Request/Page[First]
Loop
    If[IsEmpty(Pic)2]
        Set Field [3Check2, 302]
    Else
        Set Field [3Check2. 312]
    End If
    Go to Record/Request/Page[Exit after last, Next]
End Loop

Now the Check field on every record contains a "1" if Pic contains an
object, and a "0" if it doesn't.  Now we somply run a Find on the Check
field (the Find could, of course, be included in the script).

I just tried it with a test file and it works.  I'm going to need this
when I get that pesky Applescript picture import thing figured out (see my
other post).  Then I'll have 2,000 records with mostly filled container
fields & I'll need to know which ones are empty.

Steve Brown

Quote:

> Does the IsEmpty(fieldname) function not work?


> > Hy,

> > is there any possibility to detect via script/search wether a
> > media-field (image or sound) has content or not ?

> > Thanx!

> > Lothar



Tue, 10 Sep 2002 03:00:00 GMT
 Media-field with or without content ??

Quote:

> I have a similar problem, and appreciate the tip regarding IsEmpty.  At
> first I thought of making the container field calculated, but figured a
> small script would be easier.  This is what I did.  If there's a simpler
> or more elegant way, I'd appreciate hearing about it.

> Say I have a container field called Pic that could contain anything.
> There are thousands of them and i want to Find the batch that are empty.
> I make a small field that could be hidden or not called Check.  I then
> made this script:

> Go to Record/Request/Page[First]
> Loop
>     If[IsEmpty(Pic)2]
>         Set Field [3Check2, 302]
>     Else
>         Set Field [3Check2. 312]
>     End If
>     Go to Record/Request/Page[Exit after last, Next]
> End Loop

> Now the Check field on every record contains a "1" if Pic contains an
> object, and a "0" if it doesn't.  Now we somply run a Find on the Check
> field (the Find could, of course, be included in the script).

> I just tried it with a test file and it works.  I'm going to need this
> when I get that pesky Applescript picture import thing figured out (see my
> other post).  Then I'll have 2,000 records with mostly filled container
> fields & I'll need to know which ones are empty.

> Steve Brown

hi Steve,

A calculation is always faster than a looping script. Define a new calc
field called empty pict. This calculation is going to be

if(isempty(yourcontianierfield),1,0) - calc result number,

then to find the empties search the "empty pict" field for the value "1"

This is almost exactly the script you have, except I used the one as the
value to search for. Either way works, this is just faster.

Paul E.



Wed, 11 Sep 2002 03:00:00 GMT
 Media-field with or without content ??


<snip my script>

Quote:
> hi Steve,

> A calculation is always faster than a looping script. Define a new calc
> field called empty pict. This calculation is going to be

> if(isempty(yourcontianierfield),1,0) - calc result number,

> then to find the empties search the "empty pict" field for the value "1"

> This is almost exactly the script you have, except I used the one as the
> value to search for. Either way works, this is just faster.

Paul-

This is *much* better.  Thanks.  Not only is it faster, but the calc
field, of course, keeps up with the data as you add & subtract objects so
you don't have to run a script, just sort at any time.  I originally tried
to make the container field itself do a calc & store the result in the
check field, don't know why I didn't think of going the other way.

Now, do you have any idea how to import a couple thousand jepegs into the
container field at once?  The jpeg file names are the same as the primary
record id number, plus a ".jpg" suffix.  I'm using FM on a mac, but can do
it just as easily on a PC, if necessary.  There was an Applescript
included by FM5 installation called "Import Pictures" that is supposed to
do this, but I can't get it to work.

best,
Steve Brown



Wed, 11 Sep 2002 03:00:00 GMT
 Media-field with or without content ??

Quote:
> Now, do you have any idea how to import a couple thousand jepegs into the
> container field at once?  The jpeg file names are the same as the primary
> record id number, plus a ".jpg" suffix.  I'm using FM on a mac, but can do
> it just as easily on a PC, if necessary.  There was an Applescript
> included by FM5 installation called "Import Pictures" that is supposed to
> do this, but I can't get it to work.

I've just tested this Applescript and it works fine. The only thing to
do with Scripteditor:
change "PICT to "JPEG"
change the field-names "Name" and "Picture", if you want
change the name of the database from "Picture Database" to what you want

Then create a new database with at least the two fields "Name" and
"Picture" .
Run the script.
Done.
In the "Name"-field you have got the name of the picture.
In the media-field (container) you have got the picture itself.
All other things could be done afterwards

Greetings from good old Germany.

Lothar

p.s. Thank you for all those good tips.



Thu, 12 Sep 2002 03:00:00 GMT
 Media-field with or without content ??
You could even speed up the calculation suggested by Paul if you use:

ContainerEmpty = IsEmpty( YourContainerField )

this calculation will be either 0 (not empty) or 1 (empty)

in the rest of your script you could do further checks like:
If( ContainerEmpty )
  do such and so
Else
  do the other
End If

This checks whether the field ContainerEmpty is anything else than zero, so
there is no need to put If( ContainerEmpty ) = 1
You may even use the value for the ContainerEmpty field directly in a
calculation, something like:
NumberOfEmpties = NumberOfEmpties + ContainerEmpty

Greetings,

Theo



Fri, 13 Sep 2002 03:00:00 GMT
 
 [ 7 post ] 

 Relevant Pages 

1. Treenode.Data Points to Field, Not Field Contents

2. Deleting Fields through Functions - Not the contents of a field

3. getting field name from field content

4. Move Character field contents to Date field

5. Problems with field contents larger than field length definition

6. How to adding a field without commit (without log grow)

7. combo box without content, missing records by cloning, synchronizing connection

8. execute query without destroying cache contents ?

9. Changing column name and type without losing content

10. Imp/Exp to copy a database without contents

11. How to force ADO to lock current record, without changing record's contents

12. Media Name and Media Description


 
Powered by phpBB® Forum Software