Skip to main content
4-Participant
March 31, 2023
Solved

How to write relation to bring integer along with double quotation

  • March 31, 2023
  • 1 reply
  • 1402 views

I am using Creo Parametric Release 7.0 and Datecode7.0.5.0

I would like to write a relation like this STD_LUM - 2" x 4" but if I write String Parameter using Quotation mark the results comes like this STD_LUM - 2 ' ' x 4 ' '

SIZE = "STD_LUM - " + itos(W) + "''" + " x " + itos(H) + "''"

Here are the errors that I faced
Results not came as per my expectation.

Best answer by KenFarley

Most likely you have an inconsistency in the quotation marks you are using. If you want the resultant string to contain a double quotation mark it's best to enclose the strings in single quotation marks. Either will work, you just have to be careful. For example, to get what you're trying to do, the relation will look like:

SIZE = "STD_LUM-" + ITOS ( W ) + '" X ' + ITOS ( H ) + '"'

You have to make sure any quote you want to have in the string is enclosed by the "other type".

If I wanted to have both feet and inches in the type of thing you're doing, it would be something like

txtMeasure = "LENGTH = " + ITOS ( lenFeet ) + "'" + ITOS ( lenInches ) + '"'

1 reply

KenFarley
KenFarley21-Topaz IIAnswer
21-Topaz II
March 31, 2023

Most likely you have an inconsistency in the quotation marks you are using. If you want the resultant string to contain a double quotation mark it's best to enclose the strings in single quotation marks. Either will work, you just have to be careful. For example, to get what you're trying to do, the relation will look like:

SIZE = "STD_LUM-" + ITOS ( W ) + '" X ' + ITOS ( H ) + '"'

You have to make sure any quote you want to have in the string is enclosed by the "other type".

If I wanted to have both feet and inches in the type of thing you're doing, it would be something like

txtMeasure = "LENGTH = " + ITOS ( lenFeet ) + "'" + ITOS ( lenInches ) + '"'