How to create equivalent of "Is Set Exist"

Hi ALl,

I have an update from 4D v15 to 4D v17… (On Mac)

I am converting old 4D Write docs in picture format to the new Object format. Some of the docs are causing errors by running embedded 4D methods.

For example this line on a particular 4D Write doc:

WR PICTURE TO AREA ($offscreen;[CATALOG]CATpict_)

Must have a routine that calls another method which then uses sets. Like this:

INTERSECTION** ($set1;$set2;“QK RESULTING SET”)

But the sets don’t exist and thus an error.

So I’ve looked through the NUG and found a previous topic. But no real solution. I tried to trap it with an On error Call and and on WR Error Call but they seemed to be ignored.

I tied putting these lines before the call:

WR GET COMMAND INFO ($offscreen;wr cmd compute references;$Applied;$StringValue;$Name;$Status)
If ($Status=1) // enabled or disable?
WR SET DOC PROPERTY*** ($offscreen;wr cmd compute references;0)
End if

But… I think these settings get overrode when the doc is loaded from the record. And by that time the code is already running.

I realize that trying to create a “Is Set Exist” command doesn’t really solve the problem. But this code really should have some better error checking anyway.

Any ideas?

Thanks,
John…

You can try something like this

Error:=0
ON ERR CALL("errCall")  //C_LONGINT(Error)
$unused_b:=Is in set($setName)
ON ERR CALL("")
$doesNotExist_b:=(Error=39)

Hey Add,

I tried something similar earlier but … I’ll try it again.

Can you tell me if in the errCall method there is anything besides C_LONGINT(Error) ???

Thanks,
John…

Nothing else in errCall method, just C_LONGINT(Error)

Add,

Thanks. Got it working at least for that error.

These errors are due to to methods embedded in a 4D write doc. I am creating an offscreen area and the loading the doc. And since there is no way to turn off the auto compute a method is running.

WR PICTURE TO AREA($offscreen;[CATALOG]CATpict_)

So…

John…