Scripting: How to include an If-Then statement in a script intended to write text to a file?

Here is a line I wish implemented if the value of a token is under 100:
out.write( dataRecord.get( "RANK_PINunder100" ) + "\t" );

Here is a line I wish implemented if the value of a token is 100 or more:
out.write( dataRecord.get( "RANK_PIN100Plus" ) + "\t" );

One of these datarecord field values will be null and the other will have a value. RANK_PINunder100 field holds values 1-99 and RANK_PIN100Plus holds values 100 and over.

I would like to declare MyLimitedScopeScriptVar in a script, examine the 2 token values (one will be null) and assign the NON-NULL value to MyLimitedScopeScriptVar.

How do I script something like this...
IF NOT ISNULL(dataRecord.get( "RANK_PINunder100" )) THEN WildCardSessionVar = dataRecord.get( "RANK_PINunder100" ) ELSE WildCardSessionVar = dataRecord.get( "RANK_PIN100Plus" ) ENDIF ????

Then I could invoke something like this...
out.write( MyLimitedScopeScriptVar ) + "\t" );

UNCERTAINTIES:
CAN A SESSION VARIABLE HOLD NULL? IN VB, THAT REQUIRES A SPECIAL VARTYPE.
CAN A SESSION VARIABLE BE DIRECTLY REFERENCED IN A SCRIPT?
CAN A VARIABLE BE DECLARED IN A SCRIPT AND ASSIGNED A VALUE? HOW?
CAN I SAFELY ASSUME THE "\t" A TAB DELIMITER?

One more thing... Can I declare a variable for use in a script that has scope limited to the script itself. In other words, after the script is processed, variable vanishes and associated memory is freed? Would like to use a script var rather than a session var.

Thanks in advance. MrFizz [at] FizzGiz [dot] com.

I could explain all of these

I could explain all of these things to you but I think you're making things a lot harder than they have to be.

If you have 2 ways the data can be shown like this:

99
100


Just make one pattern to match both like this:

~@RANK_PIN@~


Then you just don't write out the "JUNK".

If you want to check that a value is not null, it is:

if (dataRecord.get("RANK_PIN")!=null)

If you set a session variable to null you effectively unset it.

Mike, To finish with your

Mike,

To finish with your UNCERTAINTIES:

CAN A SESSION VARIABLE HOLD NULL? IN VB, THAT REQUIRES A SPECIAL VARTYPE.

Yes (no special VARTYPE required):
session.setVariable("MyVar",null);

CAN A SESSION VARIABLE BE DIRECTLY REFERENCED IN A SCRIPT?

Yes:
session.getVariable("MyVar");

CAN A VARIABLE BE DECLARED IN A SCRIPT AND ASSIGNED A VALUE? HOW?

Yes:
session.getVariable("MyVar","some value here");

CAN I SAFELY ASSUME THE "\t" A TAB DELIMITER?

Yes:
session.log("This is a tab: \t");

One more thing... Can I declare a variable for use in a script that has scope limited to the script itself. In other words, after the script is processed, variable vanishes and associated memory is freed? Would like to use a script var rather than a session var.

Yes:
myVar = "some value here";

The best way to answers many of these questions is to test them and see. If you're not sure how to, say, set a session variables you can always reference the API.

-Scott