03-06-2022 03:21 PM - last edited on 05-25-2023 07:03 AM by JackLacava
Hi - I have created a routine in Connector Rule to fetch the Worker data from HCM and I was able to assign it to a variables and able to print it successfully.
My question is below
1. How I can assign the variables to the List because I am trying to use this connector rule in Data Source and trying to bring the data to the OS stage Area ? is it possible, My function return type is task for the RESTAPI call.
2. Or I can create a Extender Rule and create a Table in the Backend and import into the table and create an another connector rule to bring it to the stage.
Any suggestion would be appreciated.
Thanks
Krishna
03-07-2022 04:24 AM
Hi Krishna,
You would typically parse the results from the API into a DataTable and then use api.Parser.ProcessDataTable to populate Stage.
You will need to use different approaches to populate the DataTable depending on the format of the data e.g. for JSON use the Newtonsoft framework.
Lee
03-07-2022 07:56 AM
Thanks Lee. I am using NewtonSoft Framework let me try this approach and update the results.
Krishna
03-07-2022 06:16 AM
Also check this post. There is an example in that post.
https://community.onestreamsoftware.com/t5/Rules/REST-API-USE/m-p/3761#M158
03-07-2022 07:57 AM
Thanks Sai. Let me go through the BR and update you.
Krishna
03-07-2022 11:10 AM
Sai, your BR is not doing any filtering, or did I miss that part?
03-07-2022 11:31 AM
All I understood about the OPs post was how to get data from an api call and use it in a data source. Not sure if the OP wanted to filter data?
03-08-2022 09:30 PM
FYI - I am using the Public Async Function APIC(ByVal si As SessionInfo) As Task. As you see the return type is task for the API so I will not be able to pass this to the Get data function. I took a different route I created a Temp Table and inserted the API response into the table then I used normal SQL Connector function to bring it to the data source. This works for me and was able to lad the Employee data into the Cube. BTW thanks for your post and it was helpful.
03-07-2022 11:09 AM
I did ask around how to use the ClientFilterRequest method in the connector. However, there is nothing in the documentation around it or how to pass that to the connector rule. Maybe this is not exposed in the UI.
Long story short, I don't think you can pass a parameter or filter to the connector rule (even though a method is there).
03-07-2022 11:14 AM
ClientFilterRequest - Are you referring to pass query parameters to the API ?
Thanks
03-07-2022 11:18 AM
Yup, that is part of ConnectorArgs. However, there is no way to pass it though. It is there but can't use (or I'm not sure how to use it)
03-07-2022 11:24 AM
In my function I used the below to pass the query parameter and checking with the current date. I am not sure I am answered your question. Let me know if this helps
Dim Baseurl As String = "BaseUrl"
Dim Qry As String = "?q=EffectiveStartDate>"+Dt+"&onlyData=True"
Dim FinalUrl = Baseurl + Qry
03-07-2022 11:32 AM
So Dt is your parameter, and you are thinking of passing that into the connector rule to create your query? IF this is correct, then what I said is still valid. I don't know a way to pass the parameter to a connector rule. All I've seen is the ClientRequest call, and even that not sure where that is being passed. (it is in many rules, but they all fail to mention where that value is coming from).
Since you are looking for a date, can't you use the workflow you are loading and get it that way instead of passing it as a parameter?
03-07-2022 11:23 AM
Isn't that what you meant by this?
@Krishna wrote:
Hi - I have created a routine in Connector Rule to fetch the Worker data from HCM and I was able to assign it to a variables and able to print it successfully.
My question is below
1. How I can assign the variables to the List because I am trying to use this connector rule in Data Source and trying to bring the data to the OS stage Area ? is it possible, My function return type is task for the RESTAPI call.
Thanks
03-07-2022 11:36 AM
Usually you pass the filter args while calling the BR and with in the connector BR you would use
args.ClientFilterRequest.length > 0 then
'do your filtering here. if SQL then Where predicate..if api then pass this to the querystring..
03-07-2022 11:41 AM
Can you please show me where to use this? For the life of me, I cannot find a way to do it.
03-07-2022 11:49 AM
Well I haven't used this before but just reading in the ref manual..I will let you know if I find out how to 🙂
03-07-2022 12:54 PM
CK
Further looking into the Golfstream app and other connector samples "ClientFilterRequest" and "ClientSortRequest" were exclusively used in DrillBack functions.
Maybe this is just a check to see if there is a "Where" and "Order By" clauses in the drill back sql and accordingly add those clauses into the SQL String..Just my 2 cents.