Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm using a Only function with a set analysis in variable, it looks something like this:
=only({<UserCode={$(=UserName)}>} UserSiteCode)
Username is another variable with the following code: =mid(OSUser(),13)
I display the UserSiteCode in a Text Object on the main page.
Now here is problem - when I open the model the variable is null, but as soon as I go to another sheet and then back to the main then the variable contains the correct value.
Why is it doing it?
I found the problem ....
The macro where I set my selection for site was on the Sheet open trigger. When I ran the macro on the document open trigger as well all was 100% ....
Thanks all
Try defining your variable without the = at the beginning. Your set analysis doesn't need the = in the extension either and try using quotes too
=only ({<UserCode={'$(UserName)'}>} UserSiteCode)
Nope ... still the same. I think I must explain myself better. The variable is working fine but the problem is the variable is not populated with a value on startup - I must switch between sheets before is it is populated with the site code.
Can you try writing this in your script
Let UserName = mid(OSUser(),13);
and check in the variable overview if that variable is holding the value or not.
OK, I tried the following.
I entered this into my script:
Set UserName='=mid(OSUser(),13)';
Set Site='=only({<UserCode={"#(UserName)"}>} UserSiteCode)';
Let Site = replace('$(Site)', '#', chr(36));
But still the same. As soon as I enter the model Username has it's value but Site Not? When I click on the second sheet and then back to the main tab then Site has the correct value .....
I found the problem ....
The macro where I set my selection for site was on the Sheet open trigger. When I ran the macro on the document open trigger as well all was 100% ....
Thanks all