The 1C:Enterprise developers forum

#1
People who like this: 0 Yes / 0 No
Active user
Rating: 3
Joined: Sep 2, 2013
Company:

Hello;

I'd like to ask you about DynamicList and filtering.

I have two catalogs:
- Clients
- Caretakers

Clients catalog has tabular section, in which References to Caretakers can be saved. So One Client can have many Caretakers.

And now in ItemForm of Caretaker, I want to display the Clients which are under care of the Caretaker. I added a DynamicList, sel ected the Clients Catalog ... and now I want to filter it based on the tabular data fr om Clients catalog (in which the references to Caretakers are held). How can I do this?

I tried Custom Query, but then I'm stuck with the Parameter - I don't know how to assign the Form's Object.Ref to it. :(

Please help :)

Edited: Joanna Torz - Jan 17, 2014 04:32 AM
 
#2
People who like this: 0 Yes / 0 No
Just came
Rating: 1
Joined: Mar 8, 2012
Company: Smart ID

Hello,

In the ItemForm's module, try using this:

Code
&AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)
   ClientsList.Parameters.SetParameterValue("Caretaker", Object.Ref);
EndProcedure

where "ClientsList" is the name of the DynamicList and "Caretaker" is the name of the parameter from the DynamicList's query used for getting the client(s) corresponding to current caretaker.

The DynamicList's query text can look like this:
Code
SEL ECT
   ClientsCaretakers.Ref
FR OM
   Catalog.Clients.Caretakers AS ClientsCaretakers
WH ERE
   ClientsCaretakers.Caretaker = &Caretaker

Use no main table for the DynamicList.

Edited: Daniel Miu - Jan 17, 2014 06:19 AM
 
#3
People who like this: 0 Yes / 0 No
Active user
Rating: 3
Joined: Sep 2, 2013
Company:

Thank you very much, it works! :)

My Query is as follows:

Code
SEL ECT
   CatalogClients.Ref,
   CatalogClients.DataVersion,
   CatalogClients.DeletionMark,
   CatalogClients.Predefined,
   CatalogClients.Code,
   CatalogClients.Description,
   CatalogClients.Caretakers.(
      Ref,
      LineNumber,
      Caretaker,
      Percent
   )
FR OM
   Catalog.Clients AS CatalogClients
WHERE
   CatalogClients.Caretakers.Caretaker.Ref = &Caretaker

 
#4
People who like this: 0 Yes / 0 No
Just came
Rating: 1
Joined: Mar 8, 2012
Company: Smart ID

You're welcome, good day!

 
#5
People who like this: 0 Yes / 0 No
Active user
Rating: 3
Joined: Sep 2, 2013
Company:

Good day to you as well :) I would like your post if I could, but I don't have permission to vote.

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)