How To: Set parametric WHERE clause for SAP Connector in a BOARD Procedure
WHERE Clauses can be included in the SAP Query.
This implies the edit of the SAP Connector Query as the WHERE condition changes. A different and flexible approach can be taken in case a parametric WHERE clause based on specific user / dataloading conditions is required.
1) While editing the "Where" Clause of the SAP Query, identify the SAP Table Field as a Parameter with the following syntax sap_table_field_name=@parameter_name
2) Test the clause, running the query in the web-browser with some expected "where" items (e.g. Country ='IT').
3) Use the parameter option in the SAP Data Read Procedure Command Row.
The Syntax is @parameter_name=item_code.
Multiple parameters can be used to create a range of values or concatenate different conditions as in a typical SQL Where statement like :
The Syntax in then @parameter_name_1=item_1_code&@parameter_name_2=item_2_code ; sample give is @StartDate=20170101&@EndDate=20171231 that takes all the recs of Year=2017.
The benefit of such approach is that you can re-use the same Query as many time as you like customzing your where clause in the Procedure Design Environment.
Notes:
- the "&" simble has no other meaning rather than identifing multiple parameters in the string. "AND", "OR" or any other logic condition must be edit in the SAP Connector Query Design Panel.
- it is possible to list mutliple items for a single parameter using the "," like separators (e.g. @Country=IT,DE,UK)
Comments
-
Buongiorno, il parametro in questione è possibile renderlo dinamico? Provo a spiegarmi usando l'esempio sopra.
Se al posto che usare il parametro @Country=IT, quindi con "IT" inserito fisso, sarebbe possibile valorizzare tramite parametro attraverso una o più occorrenze presente in un'entità di Board?
es. @Country=@Paese, dove @Paese è un'entità di Board e viene valorizzato da una selezione precedente in fase di procedura (selezionando una o più occorrenze). Ovviamente la selezione deve restituire il codice (IT) e non la descrizione (Italia)
Grazie2