Hi Thichxai,

You are reading the entire file as a single value. I’d suggest putting bare 
id’s in your file (no quotes, no commas), one on each line. Then, after reading 
the file, use fn:tokenize to split on line-end before you pass in the list into 
your element-value-query..

Kind regards,
Geert

From: 
<[email protected]<mailto:[email protected]>>
 on behalf of Ly CafeSua <[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Thursday, June 22, 2017 at 6:41 AM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] Marklogic - xdmp:filesystem-file

I have a text file contains a list over 2 thousands customerid. when use 
xdmp:filesystem-file("opt/rec/listid.txt") to make sure it can read all 
customer id inside a file. it returns all id as expected.

"00013",
"00014"
"00015"

However when I assigned "xdmp:filesystem-file" to a variable below, the result 
always zero.  I could not figure out what wrong. please give me some hints or 
sample code.

let $listID := xdmp:filesystem-file("opt/rec/listid.txt")

let $uris := cts:uris( (),(),
                              cts:and-query((
                                              
cts:collection-query("/collection/customers"),
                                              
cts:element-value-query(xs:QName("meta:custid",($listID))
                               ))
                     )

return count($uris)

result: 0

Thanks
Thichxai
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to