@IF switch not working

A is supposed to run if it’s a NEW document in a NEW window - just close the entire window. B is supposed to run if it’s an EXISTING document in a FRAMESET - just go to the view. THIS script only always sees B. When I had both preceded by @Return, it only always saw A. How do I get the @IF switch to work properly? I created a NewDoc field with default value of “1”, but that’s not working either.

A:=“

Thank you for…


<a href="javascript.window.close()">Close New Window”;

B:=“

Thank you for…


<a href=/” + @ReplaceSubstring(@Subset(@DbName;-1);“\”;“/”)+“/Author?openview>Close Window”;

@If(IsNewDoc=“1”; A; B)

Subject: @IF switch not working

Try @IsNewDoc, not just IsNewDoc.

Subject: RE: @IF switch not working

That did not do it. The NEW window still stays open - it shows the view - but I want it to close entirely.

Subject: @IF switch not working

What is IsNewDoc a field?

For web, trapping newdoc can be a bit tricky

Set isNewDoc explicitly as a hidden field with computed formula

@if(@isnewdoc; “1”; “2”)

Subject: @IF switch not working

Heidi,

As far as I know, @IsNewDoc does not return a text value (it returns Boolean according to help which is a number really), so @IsNewDoc can never be equal to “1”. Try:

@If(@IsNewDoc = 1;A;B)

or even better

@If(@IsNewDoc;A;B)

Emily.