Combo box with specific records

Combo box with specific records

  
Hi guys,
 
Fists thing, my english isn't that good, so please if I make some mistake or if you can't undestand what my problem is, please give me a notice so I can explain better.
I'm finding some problem to implement a validation for my Edit page.
 
Suppose I have these three tables for example:
- SalesOrder (Id, CompanyId, ContactId, Value)
- Company (Id, Name)
- Contact (Id, CompanyId, Name)
 
and I have a page for SalesOrder_list and SalesOrder_edit which i have create with drag-and-drop feature (awesome btw).
 
The first problem I had was in SalesOrder_list (link New Sales Order) and SalesOrder_Edit while creating or editind an Order...I was chosing a XPTO Company in the first drop down and when I tried to insert a Contact all of the contacts was appearing, not only the Contacs of the Company I had choosen
 
 
To solve this problem I inserted a Query in the SalesOrder_edit Preparation.
 
GetContactsById
 
GetContactsById.List.Current.Contacts.CompanyId
 
 
But with this I was only able to solve the EDIT problem, because it has already the current CompanyID.
Now in the NEW Sales Order the dropbox for the Contact is empty...
 
Can somebody please help me?
 
Thanks!

P.s I forgot to tell that I've associate this SQL with the Source Record List
I just attached the oml file to help on this...can somebody explain or even better do it on the file?

Tks a lot!
Hi Andréa,

I can't open your .oml because I'm on a older version, but here goes my tip.
I think I understood your problem, you select a customer on a comboBox and then you want to select the contact. Is that right ?

Have you tried the property On Change, Destination?

Link the ComboBox where you select the company to an action, grab the CompanyId, and with that make a query to get the contacts from that company and fill a record list and load it into the Contacts combobox, and use AjaxRefresh to refresh the Contacts ComboBox.

Hope it helps.

If you want an example, fell free to ask, haven't done it because I don't want to waste time if it's not what you pretend.

Francisco,

exactly what I need to do.

"Link the ComboBox where you select the company to an action, grab the CompanyId, and with that make a query to get the contacts from that company and fill a record list and load it into the Contacts combobox, and use AjaxRefresh to refresh the Contacts ComboBox."

I tried to do as you said but I got stock in some places... 

Step 1 - Select the Company ComboBox and create a OnChange action for it 
Step 2 - ???How do I grab the CompanyId? ...some variable or something?
Step 3 - Create a query (could it be on the preparation???) to list the Contacts according to the Company ComboBox value above
Step 4 - Set the query into the Record List from the Contacs ComboBox
Step 5 - Use AjaxRefresh in the Contacts ComboBox (where?)

Could you please help me with this? I'm just learning the outsystems...maybe it's simple but I couldn't make it  : /

Thanks
Francisco,

I was able to make part of your explanation...

Step 1 - I created an On Chance Action in the Company ComboBox,
Step 2 - on that I created a query to get the the current CompanyId (just to test that I put a feedback action and after I change it gave me the corresponding CompanyId)
Step 3 - created a query to get me the list of contacs (once again i put a feedback and it gaves me the first contact of each company)

So I was excited....because everything was going fine....but I put an Ajax refresh pointing to the Contacts combobox....but all the contacs was listed...

What I need to do now?

Thanks a lot
Can someone help me? I need to present this in a few days and it's my only limitation
Attached is your eSpace with the modification Francisco sugested. :)
Hi Andréa,

Please find the eSpace in attach. I haven't tested it in runtime but it should work. What I did in a nutshell:

1) We added a new screen action that is wired to be called on the OnChange of the company combo;

2) We refresh the (Preparation) query that feeds the ContactsId Combo, passing in the CompanyId that has been selected by the user (and that triggered this OnChange)

3) Then we refresh the ContactsId Combo widget: this should reload the list from the Query above, showing only contacts of that Company;

Please let me know if it worked for you.

Happy holidays,


Miguel

EDIT - Seems like Chinita beat me to the finish line lol
As far as I can "see" you have already the solution on your hands !
I have to say that the number of people that actually help on this network is pretty amazing, and is also nice to make part of it.
Hope it helps what you got now.
Guys!!! It works!!!

I can't tell you how greatful I'm...thank you!

It is quite simple....but I was confunding the instructions...

Thanks again and Happy New Years Eve for u all...great regards from Brasil!