cancel
Showing results for 
Search instead for 
Did you mean: 

Getting NULL from iCommand's getValue() method

former_member453678
Participant
0 Kudos

Hi all

I am trying to get the details of an employee based on its name.

i have created a query with '[Param.1]' in it. .

i also set the value in it using setParam() method.

But i am unable to get the whole row of that data according to the name.

And there is no redundancy in names.

Regards

Anish

Accepted Solutions (1)

Accepted Solutions (1)

swaroop_anasane
Active Contributor
0 Kudos

Hi Anish,

To simplify your approach, you can use a iGrid Display template with your query. Now when you create an applet say named "App1" with this QT/DT combination, keep the height and width as 0.

Second step would be to get the values for the cells using following code:

document.getElementById("TextBox1").value = document.App1.getGridObject().getCellValue(rowIndex,colIndex);

Somemore methods that would help you are in the following blog:

http://help.sap.com/saphelp_me61/helpdata/EN/4c/d57bccf29560c6e10000000a15822d/content.htm?frameset=...

Hope this helps.

Thanks,

Swaroop

former_member453678
Participant
0 Kudos

Hi Swaroop,

If you could see the source code which i have posted above you would see that i had created a iGrid for it. .

but eventually it didn't work for me.

but now it is working.

Now there is a small bug in your code.

It displays the data but if i choose a different name it will show me the previous value only.

Basically it gets hard-coded.

Can you suggest a way so that everytime i press a button suppose "Reset" my iGrid values gets deleted??

Regards

Anish

swaroop_anasane
Active Contributor
0 Kudos

Hi Anish,

I think you missed to mention document.App1.UpdateGrid(true);

At the end of the param.1 passing, try this out.

This should work.

Regards,

Swaroop

former_member453678
Participant
0 Kudos

Hi Swaroop

We talked about getting values with the help of iGrid.

Is there an alternate way by which i can retrieve the values from database without the use of iGrid?

Regards

Anish

Answers (3)

Answers (3)

swaroop_anasane
Active Contributor
0 Kudos

Depends!! What version are you using??

former_member453678
Participant
0 Kudos

14.0

swaroop_anasane
Active Contributor
0 Kudos

Hi,

Following are the ways known to me:

1. You can get the data as text/JSON and then bind the controls with this json object.

2. Get the xml result from QT, and populate data from the xml. This solution is not handy with me, have come across this way back.

Thanks,

Swaroop

former_member453678
Participant
0 Kudos

This is how my page looks like. .

As you can see that i have clicked on a name under EMS.

Now what i want is that when i click on "Anish" the details of it should be fetched from the database and should be displayed in respective textboxes.

Now above is the source code of my page

Above, in the ItemSelection function i am setting parameter and trying to access the data from database with the help of applet.

But i am getting "blank" from the 5th line in the ItemSelection() function.

This above image is of the SQL query which i wrote

Please help me out.

Thanks

Regards

Anish

Former Member
0 Kudos

Hi Anish,

Please check if this blog helps.

Regards,

Sriram

swaroop_anasane
Active Contributor
0 Kudos

Dear Anish,

You should be using fixed query or SQL query to get the record. I command is meant specifically for Insert, Update, Delete type of commands. iCommand QT would give you result with no. of rows effected.

Hope this helps. Let me know if you have any further queries on query templates.

Warm Regards,

Swaroop

former_member453678
Participant
0 Kudos

Thanks for your advice.

Just to get more details to you i would say that i have used SQLQuery as a fixed query only.

Now i just want to extract the whole data of the row based on its name.

how should i do it and using what?

former_member453678
Participant
0 Kudos

if iCommand is not made for fetching records then what should i be using?

swaroop_anasane
Active Contributor
0 Kudos

Hi Anish,

You can use either SQL with SQL or FIxed mode. It all depends of the complexity of query you want to use.

Rather, if you are uncertain about the syntactical details, you should use SQL mode of SQL query. If you are writing a complex logic in the query, better go for fixed mode of the sql query.

Rest all remains same, like passing param using [Param.x] key etc. Help me with some screenshots if you need any further digging into your issue.

Hope this helps.

Thanks,

Swaroop