How can i get db entries

Hi !

I’m pretty new here and i’ve got a lot of “stupid” questions.
I have a SAP BC connected with a mySQL DB.
I build a flow with the “service generation” in SAP BC server. Populating the DB is no problem. so far so good.
but when i try to get entries from the DB, i get the data in a record list called “results”.
How can i get my data out of this record list ?
Usually there has to be a small “plus”-Icon beneath the variable name in the “pipeline out” window, right ? strangely enough there’s none.

Does somebody know why ? how can i get the db entries ?

thanks
bouml

Thomas,

your comment:
Usually there has to be a small “plus”-Icon beneath the variable name in the “pipeline out” window, right ?

The reason could your execSQL(select) from DB has no results/resultsoutput to be displayed and if it has results then $rowCount will show result count.

So please make sure the input $dbSQL input has correct sql query and also the $dbAlias settings which you have configured for that mySQL DB in the WmDB Admin settings.

HTH,
RMG.

Morning !

I attached a screenshot to show you what i have here. It’s all generated by the Server. The select statement is a simple
“select * from testtable”.
If i run the flow i get all results. But if i run it in a Browser i only get:
results: [Lcom.wm.data.IData;@360c93

So it seems that the mistake is in the output template, right ?

The code for this output in the template is:
<b>results: %value results%<br>

How can i print all entries of the record list ?

Where can i get a online tutorial/ebook to learn something about SAP BC ?

thanks

bouml

Thomas,

The reason you are getting the Lcom… is because it cannot display the result array. You will indeed need to loop over the results and display them individually. I am not sure about the BC, but there should be information in the Developers Guide (section DSP & Templates) that explains how to use arrays in your DSP. The guide ships with the BC Developer.

HTH,
Jordy

ic i have to loop over the results.
but as there is no “little plus icon” before the record list, i can’t expand it to see how the variable names are named. (for screenshot plz see post above)

Thomas,

Are you seeing $rowcount with any value in it in the pipeline?
and your results list is coming null(so no plus sign is seeing there).
Make sure the $dbAlias is connecting to that DB, check this in the WmDB homepage,and also try executing the select statement in any client SQL tool to check whether data is retrieving or no.

HTH,
RMG.

“run in browser” has this output:

all entries from DB:
number of rows: 8
sql: SELECT * FROM testtable
dbAlias: tv
dbSQL: SELECT * FROM testtable

rowcount is 8 which means that all of my 8 entries are spotted.
so connection to DB is ok. so there has to be something in the result list.
but beside from that. as you can see in the pic above. it’s a screenshot from the flow. at this point there is not yet necessary to connect to a DB, isn’t it ? so there has to be a “plus icon”.

Thomas,

Still wondering ,If $rowcount=8 then definitely the results(recordlist with plus icon)should show in the pipeline out.

Tell me is the 8 results data displaying in the browser?

Will let you know if i have some clue.

HTH,
RMG.

Thomas,

I have noticed in your screen shot of pipelineout that you setting something in $dbParamValues,$dbParamTypes.So try unmap or unset the values init and now test the execSQL.you should see the results.

HTH,
RMG.

Thomas,

Glad to know it worked,

But If the problem is with the output template then how come results not shown with (plus icon)?
Have you unmapped the params which i mentioned above?

Goodluck,

nope. i didn’t.
just changed the template.

strange thing, huh ?

Hi,

I would like to do a select in my dbsql based on a variable. My sql statement is similar to:

select * from table where field=variable;

Can someone please tell me what the syntax is? I have defined my variable in the pipeline.

Thanks,

Amlan

Hi Amlan !

BC Server can generate select statements itself.
in BC Server go to Adapters -> Databases
Choose your database, click connect (twice)and select your table. Then you can choose if you want to make a select, input, delete or update.
For a select * from table; you only have to set the bullet beneath “select”. If you also want to specify a “where-part” make a mark in the particular row.
After that, click on “generate SQL” and BC Server generates the statement.

bouml