cancel
Showing results for 
Search instead for 
Did you mean: 

How to filter data to be fetched from backend based on user input- Syclo Agentry

Former Member
0 Kudos

Hi All,

I am trying to create one app using Syclo Agentry which should list all the Flights available based on values entered by the user. I want to make the user to be able to enter Source, Destination and Date of travel.Flights matching the selection criteria should be fetched from backend.

  • I am using Syclo Agentry 6.0.14
  • I am using Northwind database in MS SQL Server 2008

Please suggest how can I implement this scenario.

Thanks in Advance

Accepted Solutions (1)

Accepted Solutions (1)

midhun_vp
Active Contributor
0 Kudos

This might help you,

- Midhun VP

Former Member
0 Kudos

Hi Midhun,

Thanks for the reply. The links that you have provided explains app creation with SAP ERP backend. But I am trying to create app using Northwind database in MS SQL Server 2008 and I am not aware where to write that logic to fetch the data based on user input.

Thanks:)

Former Member
0 Kudos

Because you are using a MS Sql, you would just need to add more where clauses to your database scripts to reduce the records to the ones you are looking for.

Stephen Streeter

Former Member
0 Kudos

Hi Steve,

Thanks for the suggestion and yes we can write where clause in SQL Queries but i want to associate that where condition with user input.

Based on my scenario, I want user to enter source, destination and travel date and then based on that, fetch should happen which will retrieve only those rows which are satisfying the user input.

Please suggest if that can be implemented in Agentry apps and where I can write that logic to associate the user input with where clause in SQL Step defintion.

jason_latko
Advisor
Advisor
0 Kudos

Anu,

Steve is correct.  I am not really familiar with the flight tutorial many people have referenced in these forums, but I can walk you through the concept of selective fetches:

In Eclipse, look at the fetches.

You will need a fetch that pulls the flight information from the database and populates your Agentry object collection.  This probably already exists?

Fetches can have properties.  This is where you will add your Source, Destination and Date properties for the user to select.  Fetch properties act like transaction properties in that you can tie screen input to them and reference the properties in backend steps.

You will need a screen set that ties to the fetch.  This is where you will map screen input from the user back to your fetch properties for Source, Destination and Date.  This screen maybe already exists?

One of your actions must have a Transmit type step that actually kicks off this fetch.  This will display your input screen and then perform a transmit.  This action probably already exists?

Looking back at the fetch again, examine the Server Exchange Steps.  This is where the link to the SQL Server code is kept that maps the SQL data back to the Agentry object properties.  If you do not find any steps here, an alternative way to handle the mapping is to put the step in the actual Agentry object definition under Reads Steps.  Look at the object that matches the Collection property for the fetch.  Find the step or steps in one of these two spots.

Modify the SQL Server step code to add additional WHERE clauses matching the data entered by the user.  You can reference the fetch variables in the code using <<fetch.Source>>, <<fetch.Destination>>, <<fetch.Date>>.  Dates may need to be manipulated with other conversion routines beyond the scope of this reply.

This should get you going down the right path.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Hi Jason,

Thank you so much for your valuable suggestion. Will try to implement and get back to you.

Anupriya

Former Member
0 Kudos

Hi Jason,

I want to implement similar kind of condition based fetch for my custom application but the only difference in my case is that I am using SAP backend.

Basic fetch containing no condition is working fine but I am facing issues while implementing this as a user defined(some search criteria) fetch.

I have tried use constructor of parent class Stephandler :setOptionalImportParameter method of basic class but as this is protected (inaccessible out of package)in Stephandler class so I am unable to set import parameters for required BAPI.

So please guide me how can I implement it??

jason_latko
Advisor
Advisor
0 Kudos

Abhishek,

Are you using the Syclo common java engine to drive your custom project?  We have a class called com.syclo.sap.bapi.BAPI that handles calling SAP BAPIs and exchanging data with them.  In your class that calls your fetch BAPI, use the setFilterRange method included in the BAPI class.  Here is an example:

setFilterRange("IT_LRP_RESOURCE_GUID_RA", "I", "EQ", partnerGUID, "");

The parameters are: Table name, Sign, Option, Low, High.  The example above will add a filter on the IT_LRP_RESOURCE_GUID_RA table that says the guid in the table must match (EQ) the partnerGUID variable (from the client application) passed to the function.  If you wanted a range to be set, you would also populate the High parameter.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Hi Jason,

I tried to implement the your suggestion of adding properties to Fetch. But I am unable to retrieve the data. I am using SQL as backend and the Company tutorial and trying to retrieve Contact Name, Phone number and City based on the Company Name entered by the user.
How do I connect the fetch properties to the input field? Is the server exchange step necessary in this case?
Each time I set the object property for the input field, it gets disabled.
Please provide some suggestions on how to implement this.
One other doubt: Is it possible to remove the navigation bar in the agentry application.

Thanks

Amitoj Singh

Former Member
0 Kudos

To fill fetch properties by a screen you need to create a new screenset not set to Object or transaction but to Fetch.

Then in the action you call your transmit step make sure to add the fetch in the "Transmit Fetches" section and then on configure what screen is to be used.

In the scripts you called <<Fetch.propertyName>> to pull the value that is set to the property.

Former Member
0 Kudos

Hi Steve,

Thanks a lot for the suggestion. I'll try it out.

Best Regards

Amitoj


Answers (0)