ColdFusion 11 CFChart issue - coldfusion-11

Gah...this upgrade to ColdFusion 11 continues to give me massive headaches!!! I encountered a couple of issues today with CFChart.
First...I used to be able to have the $$ variables in lower case..that no longer works. The documentation says camelCase works, but that still produced an error. Upper case though, thankfully, works.
Second, the values in the $$ variables seem to have gotten all screwed up...
I had this code in CF10 (and CF9, CF8 etc....)
<cfchart format="#myformat#"
chartheight="350"
chartwidth="600"
show3d="yes"
showlegend="yes"
pieslicestyle="sliced"
xaxistitle="RELATED_TO"
yaxistitle="NBR"
url="chart_rpt.cfm?value=$value$&item=$itemlabel$&series=$serieslabel$&rptpd=#rptpd#&rpttype=#rptval#">
<cfchartseries
type="pie"
query="appdata"
itemcolumn="related_to"
valuecolumn="nbr"
serieslabel="Type"
>
</cfchartseries>
</cfchart>
I had to change this to (charts look identical, by the by...):
<cfchart format="#myformat#"
chartheight="350"
chartwidth="600"
show3d="yes"
showlegend="yes"
pieslicestyle="sliced"
xaxistitle="RELATED_TO"
yaxistitle="NBR"
url="chart_rpt.cfm?value=$VALUE$&item=$SERIESLABEL$&series=$ITEMLABEL$&rptpd=#rptpd#&rpttype=#rptval#" >
<cfchartseries
type="pie"
query="appdata"
itemcolumn="related_to"
valuecolumn="nbr"
serieslabel="Type"
>
</cfchartseries>
</cfchart>
Note the change in the url clause: The value in $SERIESLABEL$ should be 'Type'...instead its 'Foreign'. The value in $ITEMLABEL$ should be 'Foreign' but instead is 'Type'. I had to switch the $$ variables around for the chart_rpt.cfm routine to produce the expected data.
Did they change the definitions of these $$ variables? Is anyone else having these issues?

Related

Why do we need the question mark in Immediate Window of VS?

So, reading this documentation:
https://learn.microsoft.com/en-us/visualstudio/ide/reference/immediate-window?view=vs-2022
It looks like the question mark (?) is an alias for the command >Debug.Print, which basically, will evaluate the expression and show the result.
So, in debug mode, instead of running this:
>Debug.Print DoSomething()
I can run this:
? DoSomething()
This is even better because I'm getting the autocomplete suggestions.
Now, the issue is that I can run the same line without a command at all, and it does exactly the same:
DoSomething()
So far looks like there is no need for the command >Debug.Print or the alias ?.
At first, I suspected that using ? will only print the result without changing the values, but this is not the case (When I assign a value to a variable using ? it is assigned and the new value is printed)
So, am I missing something here? Are there any other differences between these 3 options?
According to the documentation, if you want to use Visual Studio command, you need to add greater than sign before the command. If you run 'Debug.Print' without adding greater than sign, you will get an error.
My point is that the question mark ('?') is unnecessary if you in the Immediate Window, it is used to distinguish the typed expression from the result.

Visualforce Syntax Error for IF statement inside a Apex Repeat

I am receiving a syntax error and having a hard time identifying where I am going wrong.
I have researched several different alternatives such as wrapping <apex outputText> as well as using multiple version of {! leading into my variable calls. Unfortunately, I'm just having a hard time grasping which series of errors I am making to cause this syntax error.
The Crux of the code is:
<td>
{! IF(isTenant, ${woli.Repair_Product__r.Bill_Rate_Retail__c}, ${woli.Repair_Product__r.Bill_Rate__c})}
</td>
For variable References. This is located in a where woli is defined as:
<apex:repeat value="{!woliList}" var="woli">
and isTenant is simply hardcoded in my controller to be false for testing purposes:
public Boolean isTenant = False;
I expected my Apex Repeat command to populate different bill rates depending on the value of isTenant, but of course with the Syntax error I cannot tell if I am on the right track. Helpful tips on when multiple {!} are or are not required in Visual Force references would be helpful. I am also curious when, if ever, I should be using single or double quotation marks to define the output of the if condition.
UPDATE:
I thought perhaps I it was as simple as me not binding the condition statement to a variable in the controller class so I modified to this:
<td>
{! IF({!isTenant}, ${woli.Repair_Product__r.Bill_Rate_Retail__c}, ${woli.Repair_Product__r.Bill_Rate__c})}
</td>
Adding appropriate get/set in the controller. But alas this was not the problem the developer console still gives a mystery Syntax Error.
You don't need $ signs. Dollar is used for special fields that "depends who's looking" and other stuff not really related to data in database. You can have $CurrentPage, $User.Name, $Profile.Name, $Label.someText (that one counts as "depends who's looking" because if your preferred language is French it can display translated version.
And second thing - if you're already inside the {! some merge field syntax } you don't need more curly braces.
Try
{! IF(!isTenant,
woli.Repair_Product__r.Bill_Rate_Retail__c,
woli.Repair_Product__r.Bill_Rate__c
)}

VBScript Nothing returns garbage

We have to use VBScript as an embedded script engine in our Hospital Information System.
When we use nothing to set the value of a control (textbox/checkbox/...) it worked always fine. Since somepoint it sets now the textbox to "?>".
item("TEXTBOX").value = nothing ' Leads to -> "?>"
It is not completly clear what causes this, maybe a windows update is responsible, every rollup ~ since KB3212646 Win7 2017-01 seems to cause this error.
My Question is now, has someone else also seem this error, so that it is clear that MS causes this error or is our HIS publisher responsible for not handling nothing correct.
I know setting a textbox to Nothing is not best practice instead "" should be better, but since the item object could be more the just a textbox e.g. a combobox/checkbox this seems, from an objectoriented perpsective, better. Or am I completly wrong?
Following #Ansgar comment, you should apparently change everywhere you have = nothing to = "" in your example
item("TEXTBOX").value = ""
Beware to keep the nothing if you have the Set keyword in left
Set some_object = Nothing

VBScript - RANDOMIZE (Cbyte(Left(Right(Time(),5),2))) throws 500 for ES locales

Using a standard VBScript Randomize statement (below) which works fine -- most of the time.
...RANDOMIZE (Cbyte(Left(Right(Time(),5),2)))
RANDOMIZE...
It took a bit, but in digging thru log files, I've noticed that it throws this 500 error:
Type mismatch: 'Cbyte'
when the users' languages are non-English.
I tried changing the Session.LCID (I'm using Classic ASP) in a test page but no effect.
Any suggestions for fixing or a work-around? Thank you...
It appears you're trying to randomise based on the seconds-within-the-minute value:
12:34:56 AM
|---|
56 AM (right(5))
||
56 (left(2))
Now I have no idea of the top of my head what Time() would return in a Spanish locale, but it may well be something like 12:34:56 de la mañana.
What I do know is that relying on a specific presentation format in a globalised world is a bad idea. In your case, it may involve trying to convert left(right("12:34:56 de la mañana",5),2), or "añ", into a numeric value, something it's not going to be happy with.
If you want a true root cause analysis, I'd suggest catching the conversion error and actually logging what Time() is presenting itself as when it errors.
If you just want to fix it, find a way to get the seconds that doesn't depend on locale, for example:
secs = Second(Time())
As an aside, I'm not sure why you think this is even needed. The documentation for the VBScript Randomise function states that, if an argument is not given, the value returned by the system timer is used as the new seed value. Hence it's already based on the current time.

Code Fragment mode in Pycharm 3 debugging returns None always

When in debug mode in Pycharm, the Evaluate Expression -> Code Fragment tool doesn't seem to be able to assign and display a variable in one go. The only case that seems to be evaluated correctly is when the first line is a constant value.
eg.
10
results as expected in
result = {int} 10
but when trying to obtain the same result with:
c = 10
c
the output is
result = {NoneType} None
However, if I hover over each variable in fragment window, the values are shown as a popup.
Edits to sum up the comments (thanks Vaibhav Mishra):
Unfortunately, this seems to be the default behavior: (won't fix bug)
My understanding of this feature:
Although Pycharm will display a None result when evaluating multiple lines, they are all executed in the context of the currently selected stack frame. One of the consequences being the update of the namespace. Subsequently using single-line evaluations in the same context (or mouse hover) will display the expected values.
Two potential usages:
The Evaluate Code Fragment dialog is automatically prompted when evaluating multiple lines from the editor: Select a block | Evaluate Expression (Alt+F8). May be useful to tweak a couple of lines and run evaluation in one go.
As an alternative to the Debug Command Line, the code fragment mode supports loops and if/else. Although the inspection seems a bit tipsy (mistakenly unresolved variables), it can be ignored, and the editing assistance provided there can be put to good use.

Resources