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: 
<general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>>
 on behalf of Ly CafeSua <thich...@gmail.com<mailto:thich...@gmail.com>>
Reply-To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Date: Thursday, June 22, 2017 at 6:41 AM
To: "general@developer.marklogic.com<mailto:general@developer.marklogic.com>" 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
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
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to