Link to home
Start Free TrialLog in
Avatar of sherihan
sherihan

asked on

Using dropdownlistbox, radio buttons and data stores.

Hi all,
I'm new to powerbuilder and I'm facing some problems.
I'm in urgent need for reply.
If anyone could help me I'll be so thankful.
I have two tables:  
friends (id integer, name character, gender bit, activity_id number),
another table for the activities (activity_id, activity_name).
I want to create a window that shows friends’ data and use the drop down list box to show friends’ activities as well as using a radio button to show friends’ gender.

In this window when clicking on certain friend, shows in a single line edit control that shows the total number of his activities (using data store).

How could this be done?
Please, I need a detailed answer with code samples(if possible).

Thanks in Advance.
Avatar of diasroshan
diasroshan
Flag of Kuwait image

hi,

can u pin point exactly what u are finding difficulty in accomplishing.... i'm sure u must have tried some stuff and ur gettin stuck at some places....

please pin point what u exactly want so we can answer it...

Cheers,
Rosh
Hi,

Suppose u have a datastore with the SQL...
Select Distinct activity_name
From activities

to add items to a list box the code is as follows...
string name
Long i

For i = 1 to ds_1.RowCount()
      name = ds_1.Object.activity_name[i]
      lb_Actions.AddItem(name)  //lb_Actions is the dropdown list box
Next


to get the total no of activities for a friend... u can take the name or id in a variable and use an embedded SQL and get the count...

For Eg.
ls_name = 'sherihan'

Select Count(ativity_id)
Into   :ll_Count
From   friends
Where  name = :ls_name;

then u can set this count to a single line edit control as follows...
sle_1.Text = ll_count


u can also have 2 radiobuttons and place them within a group box...
from the datastore that u have created u can also get the gender of the friend...
so u can use,,,

If ls_gender = 'Male' Then  //or whatever ur database value is
      rb_1.Checked = True
Else
      rb_2.Checked = True
End If


do ask for more assistance...

Cheers,
Rosh
Avatar of sherihan
sherihan

ASKER

Hi Rosh,
Thanks a lot for ur reply.
But, i still want to make sure of some points.
I'll tell u exactly what i tried to do and would like to know if this is possible or not.
I created the two tables and i tried to use the edit styles available in powerbuilder.
I succceded in creating radio buttons edit style for the gender column.
I also created a drop down list box edit style and i assignmed it to the activities_id column.
But when i tried to enter values in this drop down list box i was not able to enter more than one row.
I s it possible that i use drop down list box edit style and that this drop down list box accepts more than on row.
in the application I want to create a data window to show the details of all friends with the drop down list containing all the activities for each friend.
Is this possible?

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of diasroshan
diasroshan
Flag of Kuwait image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
harish_varghese,

>>Everything is possible.. u just need to try
>>Use a dropdown datawindow to display the activity name instead of id as mentioned by Rosh
I am not sure whether what u told is correct ...........How can u select multiple values from a dropdown. DrownDown datawindow would only allow one value to be selected.

amit
Yes Amit,
We cannot select multiple values in dropdown DW.
My comment was for reporting purpose, not data entry. If u have values in the table, the method i suggested can be used to display those values, but certainly NOT for entering the data.
Thanks,

Harish
Hi,

tried to satisfy the author as per my understanding of the post...

hope he got his solution...

Cheers,
Rosh