@Compif syntax difference in other locales
Forums
Hi,
I am using @compif function in equation for appending field through idea script. This works fine in English/United states locale. When I changed locale to French, the equation is not working.
Each condition in @compif is separated by comma (,). But in French locale, it is showing that semi colon (;) has to be used for each condition.
So my code is not working in French/German locales.
Syntax for English: @CompIf(<num> Condition1 , <any> Result1 , <num>Condition2 , <any> Result2,...)
Syntax for French: @CompIf(<num> Condition1 ; <any> Result1 ; <num>Condition2 ; <any> Result2;...)
See screen shots attached for equation editor in English and French locales. Ideally method syntact should be same irrespective of locale. Correct?
Is there any way to make this function working in all locales?
Please ignore above request.
Please ignore above request. I got it from SA SDK help.
Dim SimpleCommands As Object
Dim value As String
Sub Main
Set SimpleCommands = SmartContext.MacroCommands.SimpleCommands
value = SimpleCommands.ListSeparator
'Release object.
Set SimpleCommands = Nothing
End Sub
Hi Brian,
Hi Brian,
I am storing the list separator in a string variable (sListSeparator ) initially and use that in equation like below.
field.Equation = "@compif(Status_Code=""1""" & sListSeparator & " ""Matched""" & sListSeparator & " Status_Code=""2""" & sListSeparator & """PO without INV""" & sListSeparator & " Status_Code=""3""" & sListSeparator & """INV without PO""" & sListSeparator & "Status_Code=""4""" & sListSeparator & """Missing Data""" & sListSeparator & "1" & sListSeparator & """Missing Data"")"
Hi Shafeer,
Hi Shafeer,
There is a command called ReplaceByListSep that helps for these equations. Yours above would look like this:
Set oSC = SmartContext.MacroCommands.SimpleCommands
field.Equation = oSC.ReplaceByListSep"@compif(Status_Code=""1"" ## ""Matched"" ## Status_Code=""2"" ## ""PO without INV"" ## Status_Code=""3"" ## ""INV without PO"" ## Status_Code=""4"" ## ""Missing Data"" ## 1 ## ""Missing Data"")", "##")
The ## is used to be replaced by the list separator, you define the ## at the end of the function so it can be anything that is unique, I think in their documentation they use ## as you would not see that combination in an IDEA equation.
Brian
Hi Brian,
Hi Brian,
In Vietnam locale, both the list separator and decimal separator are comma (,).
So methods like @If is failing, if we called like this
@if(1=2, 0,1)
I think it is considering 0,1 as 0.1. So incorrect paramter error is showing in equation editor.
Is there any way to move forward?
Thanks,
Shafeer
Hi Mohamed,
Hi Mohamed,
Unfortutunately the syntax changes depending on the region settings of the computer as you have found out. As you are doing this in script there is a way around it. You can check out my blog that talks about this problem along with a solution: http://ideascripting.com/blog/2015/08/03/how-internationalize-and-local…
Also if you have access to the IDEA 10 passport web site there is a document on there called "Internationalization of IDEAScript Macros" that also talks about this.
Good luck with your project.
Brian