Environment variables not being set

I have some code in a button that is supposed to set some environment variables, then close the existing document and create a new one. Although the close and create is working, the environment variables are not being set. I’ve added prompts in various locations in the code to see what is happening, and I’ve tried setting a variable to a hard-coded string to see if it’s a problem with access to fields. Here’s the code, with the results commented.

@Prompt([ok]; “fileType”; fileType); 'this displays the correct value of the fileType field

@SetEnvironment(“fileType”; fileType);

@SetEnvironment(“fileLocation”; fileLocation);

@SetEnvironment(“mediaType”; mediaType);

@SetEnvironment(“comments”; comments);

@SetEnvironment(“printingNum”; printingNum);

@SetEnvironment(“testString”; “testString”);

@Prompt([Ok]; “varBeforeSave”; @Environment(fileType)); 'this displays blank

@Prompt([Ok]; “varBeforeSave”; @Environment(testString)); 'this displays blank, so even setting the environment to a hard-coded string isn’t working

'all other prompts beyond this are blank

@Command([FileSave]);

@Prompt([Ok]; “varAfterSave”; @Environment(fileType));

@Prompt([Ok]; “varAfterSave”; @Environment(testString));

@If(ok=“true”;

@Do(

@Prompt([Ok]; “varInsideDo”; @Environment(fileType));

@Prompt([Ok]; “varInsideDo”; @Environment(testString));

@Command([CloseWindow]);

@Command([Compose]; “fmPreserveTC”)

);

“”);

The results are the same whether I use @SetEnvironment or just @Environment. So it seems like no matter what I do, the environment variables are not getting set. I had thought maybe my notes.ini file was corrupt on this machine, so I tested it on three other machines with the same results. I’ve never had problems setting environment variables before - what could the problem be?

Subject: Environment variables not being set

Hello Esther,

I noticed you called the @environment function with variables.

Shouldn’t it be @Environment(“testString”) instead of @Environment(testString)?

Regards,

René

Subject: RE: Environment variables not being set

You’re right, Rene, but I’ve already fixed it in my actual code. The prompts work correctly, but the environment variable values disappear somewhere into the ether between the time they’re used in the prompt and the time the new document is opened. I’ve looked at my notes.ini file and the values are not there, and the fields that are supposed to get the values of the variables are not. Here’s the code for the fields, which should retrieve the value of the variable if it exists; otherwise it displays the saved field value.

@If(@Environment(“fileType”) != “”; @Environment(“fileType”);fileType)

Subject: RE: Environment variables not being set

If you’re setting the env variables and going to check your ini to see if they are there right away you’re not going to see them. They ARE there but you won’t see them in the ini until you close Lotus Notes following when they are set. I would check your fields to make sure they are setup correctly to receive the env. values after they are set.

Subject: RE: Environment variables not being set

Shouldn’t this code:

@Environment(“fileType”)

in the default value field of an editable text field pull in the value of the fileType environment variable?

Subject: RE: Environment variables not being set

Hi Esther,

Yes, it should!

I tested your code and it worked fine in my case. All the environment vars were set.

Since the ECL is set correctly, I also don’t know where to look elsewhere.

Please post if you find solution.

Regards & good luck,

René

Subject: RE: Environment variables not being set

I really don’t have a clue where to go from here, other than assuming that maybe the form is corrupt and recreating it. Guess I’ll start there…

Subject: RE: Environment variables not being set

I would try putting the attempted write to the “test string” ahead of the others in the code. It would have to be one of two things I think…1. You do not have access in the local ECL to perform the requested operations…(which is unlikely)…

  1. An incompatible data type/error in one of the values being written…

If you put the test string ahead of the others, and it is written successfully, walk it down line by line…

Subject: RE: Environment variables not being set

Nope, it doesn’t work either. It works in the prompts, but the value vanishes before the new document opens. And yes, I have the correct ECL access. And the data types are all plain strings, which display correctly in the prompts. So there’s no reason for them to not be stored as variables, and yet they aren’t.