03-20-2006 12:09 PM
I got some code to make changes to it. Now there is sequence step in the AddHeader subsequence. Like this
Locals.Header += "\t\t"+Str(("MODEL", "UUTPartNum"), "% -30s") + StationGlobals.UUTPartNum + "\n"
I have seen the NI model sequence step like this
Locals.Header += "\t\t"+Str(ResStr ("MODEL", "UUTPartNum"), "% -30s") + StationGlobals.UUTPartNum + "\n"
Now I want to know how does the Str(("MODEL", "UUTPartNum"), "% -30s") works without ResStr? If I am correct in assuming that it doesn’t actually serve any purpose should I just go ahead and change it to just
Locals.Header += "\t\t"+"UUTPartNum" + StationGlobals.UUTPartNum + "\n"
The person who was developing is not available so I was wondering if that missing ResStr is an omission.
Please provide your comments.
Sumit
03-20-2006 12:58 PM
It is pretty clear that the missing ResStr was an accident. It serves no purpose. Since the comma operator alway evaluates to its last argument, the change you made is equivalent.
However, the writer probably did intend the string to be localized, so the correct fix would be to add the ResStr back in and then verify that there is a custom strings file that has a [Model] section with a UUTPartNum tag that defines the localized text.
03-20-2006 05:55 PM
Sumit,
Str() and ResStr() are two different functions.
Str() formats a property value to a string whereas ResStr() returns a string value from the language resource files located under your 'TestStand\Components\NI\Language\English' and 'TestStand\Components\User\Language\Englis' directories.
For example:
Locals.Header += "\t\t"+Str(ResStr ("MODEL", "UUTPartNum"), "% -30s") + StationGlobals.UUTPartNum + "\n"
In this line of code you would go to the files under your language directories and search for the string corresponding to the "UUTPartNum" tag under the "MODEL" category.
Once you get the string you woul format it using the format string "%-30s".
And as James said it is clear that it is an ommision.
Hope it helps.
Best Regards.