String Initial Value with quotes bug - porting a C6 app to C11

C6 app with a local astring
Loc:Astring ASTRING(’’‘Initial Value’’’)

becomes in C11
Loc:Astring ASTRING(’‘Initial Value’’)
and it throws a compiler error
Expected: ),&={

Have you tried single quotes?

yeah, only way to get it to compile and work is remove all the single quotes from the column properties, attributes tab, initial value entry field.

It doesnt like single quotes, havent tried other string fields to see if its affecting all string fields or just the astring field.

I’m testing here in build 11.1.13815, and all the following lines work.

loca astring('bob')
locb astring('''bob''')
locc astring('"bob"')

Incidentally I notice your code was indeed illegal, but I’m not sure if that’s a typo when entering here. Your post didn’t use single and double quotes, but rather other quoting characters.

What do you mean by other quoting characters?

I’ve just used the same single quote on my keyboard that I use elsewhere.

I removed the quotes as it was the only way to get it to compile and then just a moment ago I add a single quote before the words and one after and then it throws that error message.

Now if you are referring to the fact where the single quotes seen on this website, where the first single quote is a single quote and the other is the opposite way up, thats this website doing this when I paste to it.

The problem is, if I use the datapad and wrap the words in the initial value entry field in single quotes, the code goes from one single quote wrapping the initial value, to two single quotes wrapping the initial value when the IDE should be writing out 3 single quotes to wrap the initial value.

I’m on 11.0.0.13244

maybe it’s been changed between 13244 and 13815.

If you post my code into your app, do you still get an error?

Its the appgen which is generating the code wrong, the text in an embed is ok.

So how does the AppGen generated code look different to the code I posted?

Which template are you using to generate this procedure? (ABC ? Legacy? Something else?)

What is the “initial value” in the Data Pad set to?

Cheers
Bruce

C11 ABC template.
Datapad values / clw output
initial value/‘initial value’ - compiles
‘initial value’/’‘initial value’’ - compiler error with this one
‘‘initial value’’/’’‘initial’’’ - compiles

C6 ABC template.
Datapad values / clw output
initial value/‘initial value’ - compiles
‘initial value’/’’‘initial value’’’ - compiles
‘‘initial value’’/’’’’‘initial’’’’’ - compiles

It’s simply that the APP conversion from C5-C6 screws up some String Initial Values that contain quotes. As you show the outside quotes were removed leaving it invalid. I know I have seen this.

C5-6 I’m never quite sure if an initial value on a String type needs the quotes entered, or App Gen sees is a String and adds them. It changed at some point, and I think at one point Global data worked differently than Local. C8 forward is consistent.

Fix your APP in C11 and move on.

Originally, you probably should not have placed quotes for the initial values of variables in Procedure template prompts. Knowing when to use single quotes or not for a template prompt has always been problematic for me. It is up to the template developers to be consistent. You pretty much have to inspect the generated code to see if you ended up with what you wanted or not. If you really wanted single quotes to be stored inside your ASTRING variables then I’d probably have used <027h> nomenclature in the template prompt.
P.S. Does your app really need ASTRING variables? Seems like there are some esoteric uses for ASTRING. Wouldn’t it be much better to replace them with simple STRING or CSTRING or, perhaps a CLASS that gives you all the string manipulation functions that SV never developed?

1 Like

If I recall correctly, C6 and prior were inconsistent with the way that was done in the Dictionary versus the data pad. I believe they made it more consistent somewhere along the line, but that broke anything that utilized the inconsistent nature of the earlier version.

1 Like