kernfamily4
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2016
12:37 AM
Global String Functions in SG App
I am trying to use the global string functions in my app and I am receiving compile error messages. Do I need to include something for these functions to work? I noticed the SG example files do not have Makefiles. Do I need one with some reference to the global functions?
Here is some test code that is in my Init function of my main scene component:
'** Trim off "List" from the FilterName and add "ID"
FilterName = "CategoryList"
Pos = Instr(FilterName, 1, "List")
Key = Left (FilterName, Pos - 1) + "ID"
Here are the errors I am receiving:
--- Syntax Error. Builtin function call expected. (compile error &h9d) in pkg:/components/TestScene.xml(15)
--- Syntax Error. Builtin function call expected. (compile error &h9d) in pkg:/components/TestScene.xml(16)
I am unable to find any explanations for error messages in the documentation.
I also tried this code and received the same error messages:
'** Trim off "List" from the FilterName and add "ID"
FilterName = CreateObject ("roString")
FilterName = "CategoryList"
Pos = FilterName.Instr(1, "List")
Key = FilterName.Left (Pos) + "ID"
Any help would be appreciated. Thanks.
Here is some test code that is in my Init function of my main scene component:
'** Trim off "List" from the FilterName and add "ID"
FilterName = "CategoryList"
Pos = Instr(FilterName, 1, "List")
Key = Left (FilterName, Pos - 1) + "ID"
Here are the errors I am receiving:
--- Syntax Error. Builtin function call expected. (compile error &h9d) in pkg:/components/TestScene.xml(15)
--- Syntax Error. Builtin function call expected. (compile error &h9d) in pkg:/components/TestScene.xml(16)
I am unable to find any explanations for error messages in the documentation.
I also tried this code and received the same error messages:
'** Trim off "List" from the FilterName and add "ID"
FilterName = CreateObject ("roString")
FilterName = "CategoryList"
Pos = FilterName.Instr(1, "List")
Key = FilterName.Left (Pos) + "ID"
Any help would be appreciated. Thanks.
2 REPLIES 2
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2016
01:14 AM
Re: Global String Functions in SG App
POS is a reserved word in BrightScript, see https://sdkdocs.roku.com/display/sdkdoc/Reserved+Words
You should never, ever - never ever - use one of the reserved words as variable name, it won't work.
I agree, the diagnostic does not help. In its defense, pos(0) is an obscure function (related to PRINT).
You should never, ever - never ever - use one of the reserved words as variable name, it won't work.
I agree, the diagnostic does not help. In its defense, pos(0) is an obscure function (related to PRINT).
kernfamily4
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2016
08:29 AM
Re: Global String Functions in SG App
Thank you,
I never thought to check the reserved word list. In my defense, the message did not mention reserved words. On the other hand, POS is a function in many languages, so I should have known better.
Have a great day
I never thought to check the reserved word list. In my defense, the message did not mention reserved words. On the other hand, POS is a function in many languages, so I should have known better.
Have a great day