Outputting quotes in a string


Is there a way to output single or double quotes via a PRINT statement?

We’re looking to build up a zonelist automatically from a file containing a list of zones - so are reading it in as a record file and looping over the records to build up the string.

The final string we want to output to a text files is something like

CityCentre = ‘1,3,56,68,134,246’

but are struggling to get Cube to output a single quote as that’s used to define the string to outputs

i.e. we have
Rec1: CityCentreList = 'CityCentre = ‘1,’
Rec2: CityCentreList = CityCentreList + ‘3,’

RecN: CityCentreList = CityCentreList + 246 + ’ ’ ’

but Cube doesn’t like the single quotes in in the first and last lines.

Is there some way to escape the single quote character? Or use an ASCII code or similar?



Hii Matt,

You can trying using this logic. If you want to have single quotes in print file, then you can use double quotes outside to define the text and vice-versa.


Thanks for the reply.

Changing the single quotes for double worked - though did require a rethink of the process.

We were trying to build the entire zonelist string into a variable - so we’d have CityCentre = ‘1,3,56,68,134,246’ saved to the variable CityCentreList and could then output that.

However, in that situation you can’t use the double/single quote trick. It only works when using PRINT. So we rearrange the process to create the list of zones and save that in CityCentreList and then only add the single quotes in the PRINT statement.