on 06-28-2017 12:37 AM
Hi Experts
I have a scenario where I have to lookup the "company name" for a user from a JDBC table. A user may have multiple companies associated. There is another column "Last Updated Date" so I need to pick the company with the latest LastUpdatedDate.
The table looks like
User CompanyName LastUpdateDate
A CompanyA Date1
A CompanyB Date2
B CompanyC Date1
D CompanyB Date3
So while looking up is it possible to send a query something like "order by
LastUpdatedDate" and then pick the first record?
Or
Would have to write a udf to fetch all the records?
Or
can it be done without a udf?
Kindly assist.
Regards
Sonal
first try if this can be achieved by select query from sender channel itself. you can do the filtering in UDF but it is not required if the channel sql works out.
https://stackoverflow.com/questions/189213/sql-selecting-rows-by-most-recent-date
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Receiver channel is required doing JDBC lookup. you have to construct the message type as per sql_query
https://help.sap.com/saphelp_nw73/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
https://help.sap.com/saphelp_nw73/helpdata/en/44/7b7855fde93673e10000000a114a6b/content.htm
you can use select statement also to fetch records.Please check.
https://help.sap.com/saphelp_nw73/helpdata/en/44/7b7171fde93673e10000000a114a6b/content.htm
I thought you are fetching records from sender side. That is why i told to configure the sql query in sender channel. I misunderstood. Please ignore sender channel part.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.