Search code examples
sap-commerce-cloud

How to export customer details on the basis of the email ids present in a CSV using Hybris export


my problem statement is - to fetch the uid and name on the basis of uids(A CSV which has a list of uids) that I input.
Now this can be done by following query:
_"#% impex.setTargetFile( ""Customer.csv"" );" insert_update Customer;uid[unique=true];name; "#% impex.exportItemsFlexibleSearch( ""select {pk} from {Customer} where {uid} in ('testcustomer1@gmail.com','testhello1@gmail.com')"");"_
The result in csv will be the following:
testcustomer1@gmail.com;Test1|Customer1
testhello1@gmail.com;Test|Hello

But, the issue is that for 2 uids its easy, for 600k customers if to fetch out of 1200k is tough. I have a CSV of email ids from which I wish to refer here so that the list can be used directly somehow instead of manually adding 600k customers.
Kindly provide a solution for the same.
Thanks in advance.


Solution

  • Using CSVReader you can achieve the same.

    INSERT_UPDATE Product;code[unique=true];...
                        "#% CSVReader reader = new CSVReader( ImpExManager.class.getResourceAsStream(""myDataFile.csv""), ""utf-8"" );"
                        "#% reader.setMaxBufferLines(100000l);"
                        "#% impex.includeExternalData( reader, 1, -1 );"
    

    For more details visit the help.hybris.com below link.