Query via code
Roberto Marra
Hi there,I would like to know if is possible to use the query I defined in SAP thru code, instead to use the databand.
I saw that there is a chance to use an object Recordset where using a method you can pass a query string. I was thinking that maybe is possible to use a query already done.
Hope I was clear in my explanation
Regards
Roberto
Philipp Knecht
Hi RobertoI'm not sure if i understood your question.
To use queries from B1 in coresuite designer just add them into the datasources list on the Layoutdefinition form.
This way the query gets executed, related into the b1_data - tree (if there are linkfields) and it can be used visually from within the designer.
On the fly creating of datasources is possible but not supported by the designer.
You can always call LD.QueryData("...") to get single values.
hth
Roberto Marra
Hi Philipp,sorry that I didn't explain myself properly.
Working as you said is fine and until now I worked in this way. But I was checking if there is another way and looking in the code of some other forum request I saw that you can do something like:
Dim oRecordSet As SAPbobsCOM.Recordset
Dim idContact As String
oRecordSet = SwissAddonFramework.B1Connector.GetB1Connector().Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oRecordSet.DoQuery("SELECT MAX(ClgCode) FROM OCLG")
So I thaught that maybe you can do as well something like
oRecordSet.DoQuery()
Im just checking what I can do via code, coz I would like to take full advantege of this report designer so powerful
Thnx
Roberto
Philipp Knecht
Hi RobertoYou can display any expression you want.
But i wouldn't do an repetitive area like that because dataBands can be bound to objects which support/needs some specific interfaces.
We are using DataSet / DataTable which supports that interfaces.
But for header Data its ok to use for example:
(In Generatescript of the document)
oBP = SwissAddonFramework.B1Connector.GetB1Connector().Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartner)
And then you can use it like BP.CardName with full Intellisense support.
btw you don't need to use the RecordSet Object. There is an optimized access via SwissAddonFramework.B1Connector.GetB1Connector().ExecuteQuery....
hth
Roberto Marra
Ok Philipp,thnx for your explanation.
Do you think there are documentation with example of how to use all the main object in your SwissAddonFramework namespaces? Could be very helpful... I guess
Thx anyway
Roberto
Philipp Knecht
Hi RobertoThere is a specific forum for framework questions.
The following link points to framework coding examples:
http://www.coresuite.ch/fileadmin/user_upload/swissaddons/framework/coresuiteFramework_Samples.zip
hth
Roberto Marra
Really appriciate man!Thx
Roberto
0
Please sign in to leave a comment.
Comments
0 comments