cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

How to write relation to bring integer along with double quotation

HK_8735192
4-Participant

How to write relation to bring integer along with double quotation

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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 ) + '"'

View solution in original post

1 REPLY 1

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 ) + '"'
Top Tags