Bruce,
Instead of trying to locate the file extension from the parsed columns consider 
populting the DocExt column by using the original full file name in populaing 
the column. By definition the file extension appears after the last "." in the 
full file name. Therefor the object is to find the position of the last "." via:
To find the LAST occurrence in the value of a string, use the "-1" parameter in 
set var vLast = (SLOCP(.v1,'.',-1)) . Here is the full function to get the file 
extension
set var vext = (SGET(.vFN,(SLEN(.vFN)) - (SLOCP(.vFN,'.',-1)), 
(SLOCP(.vFN,'.',-1)) + 1 ))

to test I used set var vFN = 'file.name.ext' 
You can build it into the parse process when loading the table or if the table 
includes the full file name make DocExt a computed column replacing .vFN with 
the 
column name.

Jim Bentley, American Celiac Society     On Friday, May 15, 2020, 07:11:00 PM 
CDT, Bruce Chitiea <[email protected]> wrote:  
 
 #yiv3603970538 blockquote.yiv3603970538cite 
{margin-left:5px;margin-right:0px;padding-left:10px;padding-right:0px;border-left:1px
 solid #cccccc;}#yiv3603970538 blockquote.yiv3603970538cite2 
{margin-left:5px;margin-right:0px;padding-left:10px;padding-right:0px;border-left:1px
 solid #cccccc;margin-top:3px;padding-top:0px;}#yiv3603970538 a img 
{border:0px;}#yiv3603970538 #yiv3603970538 #yiv3603970538xe0043a7ba6e9483 
#yiv3603970538x86b4dd35dfc94ef5a5432fdb70f5f643{font-family:"Segoe 
UI";font-size:12pt;}#yiv3603970538 
#yiv3603970538x8050b8445ef34e44899f4376a6e16502{font-family:"Segoe 
UI";font-size:12pt;}All:
Courier New font
BACKGROUND
For a file naming and re-naming project, several thousands of custom-delimited 
document filenames are to be parsed into fields within table ParsedFileNames. 
The field count for each record varies by class and filetype, so that the 
filename extension scatters over a range of fields. 
The goal is to copy the filename extension from whichever field it falls 
within, to common column DocExt, ideally as the table is being populated.
To this end, during parsing, SLOCI generates a field count to be stored in a 
FieldCount column for each record. Since the filename extension is the last 
field in a parsed filename, the extension is found within Column# = FieldCount.
ISSUE
By itself ...
SELECT ('#'+(CTXT(FieldCount))) FROM ParsedFilenames
... produces:
#13#11.#10
... as intended. So, I'd thought this would do the trick:
UPDATE ParsedFileNames +   SET DocExt = +SELECT ('#'+(CTXT(FieldCount))) +  
FROM ParsedFileNames + WHERE DocExt IS NULL
... which produces the error:
"Illegal table name - ('#'+(CTXT(FieldCount))) (2037)"
Several attempts to turn the offending string into a variable, for use as an 
ampersand variable, have also failed. Still working at it, but clearly not 
getting it.
How might the column number be specified within the SELECT statement, to avoid 
resort to a WHERE loop or CURSOR?
Many thanks, Bruce
Bruce A. ChitieaSafeSectors, Inc.112 Harvard Ave #272Claremont CA 
[email protected]+011 (909) 238-9012 c



-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/emdaf59928-37f7-4860-a39e-91a4b7d4e199%40pathfinder.
  

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/1985439270.620569.1589756990489%40mail.yahoo.com.

Reply via email to