Page 1 of 1 1
Topic Options
#207920 - 2013-10-17 10:55 PM Substr help
jenefa Offline
Fresh Scripter

Registered: 2013-02-01
Posts: 15
Loc: USA
Dim $aMatchIdx[] ; an arrary variable declared.
$aMatchIdx = AScan($aRecord, Substr ($obj.name), 4)),,,2)

What is wrong with the line above
I am trying to capture a substring excluding the first 4 characters into an array variable.

I am getting error
ERROR : invalid method/function call: missing required parameter 2!

Help !!!!


Edited by RajeshJohn (2013-10-17 10:56 PM)

Top
#207922 - 2013-10-18 04:25 AM Re: Substr help [Re: jenefa]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
SubStr requires more than one parameter, just as the error states. Try...

Dim $aMatchIdx[] ; an arrary variable declared.
$aMatchIdx = AScan($aRecord, Substr($obj.name, 4),,,2)

Top
#207923 - 2013-10-18 04:27 AM Re: Substr help [Re: ShaneEP]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
FYI...having 2 ('s and 4 )'s is usually a pretty good indication of a syntax error.
Top
#207924 - 2013-10-18 02:58 PM Re: Substr help [Re: ShaneEP]
jenefa Offline
Fresh Scripter

Registered: 2013-02-01
Posts: 15
Loc: USA
Thanks for your help.

Doing this fixed it for me.

$aMatchIdx = AScan($aRecord, Substr(($obj.name), 4, 100),,,2)

Top
#207925 - 2013-10-18 03:17 PM Re: Substr help [Re: jenefa]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Shane's version was correct and even shorter, but I guess it you do what feels best...
_________________________
!

download KiXnet

Top
#207926 - 2013-10-19 02:01 AM Re: Substr help [Re: Lonkero]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
RJ

On my web site is a package called the Kix Development Kit. It consists of a KGen.BAT Kix script, User Guide, and the complete collection of UDFs from our dev library. (yes, kixtart BAT file!)

With a few installation steps, you can reference any UDF in the library in your code. Create your source script as a .TXT file, then run "KGen filename" (no .txt extension) and KGen will index the UDF library, parse your code, insert every UDF that was referenced (recursively!), and then perform a "sanity check" looking for undeclared vars, declared but unreferenced vars, and mismatched object pairs (parens, braces, brackets, quotes, and even command-pairs like if/endif). The warnings are displayed, logged, a log of functions used, variables used, and a "paired function map" are created, all of which help to find these issues without tedious line by line review. You can even manage large projects with a small .TXT, several .UDF modules, and your standard UDF library.

Some more advanced features include a config file that allows building your script by simply running "KGen" without args, building several configurations by specifying a config ID on the command line, and the ability to copy / rename the script to multiple locations.

Free to download and use with registration on our site.
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.069 seconds in which 0.037 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org