7 Replies Latest reply on Nov 15, 2013 11:11 AM by NaturSalus

    Removing current ID from value list

    NaturSalus

      Title

      Removing current ID from value list

      Post

           Hello,

           I am using the Document table to record the hierarchical relationship among the document records. So, all documents but one will have a "parent" document and possibly one or more "child" documents.

           The relevant Document fields are:

           __kp_Document

           _kf_ParentDocument

            

           The established relationships are the following:

      Document ::__kp_Document = DocumentToChildDocument::_kf_ParentDocument

      Document::_kf_ParentDocument = DocumentToParentDocument::__kp_Document

            

           On the Document_Detail layout, based on the Document TO, there is the Document::_kf_ParentDocument field used to assign the "parent" document record ID to the current document record. 

           The Document::_kf_ParentDocument field gets its values from a the ParentDocument value list with the followign settings:

           Use values from first field: Document::__kp_Document

           Also display values from second field: Document:.DocumentName

            

           With these settings there is no way to prevent  the current document record ID  from being displayed.

            

           So if we have already entered 2 documents being:

           Document 1:  Document::__kp_Document = 1  Document::DocumentName = Manual

           Document 2:  Document::__kp_Document = 2  Document::DocumentName = Instruction 1

           when the 3rd document is created with Document 3:  Document::__kp_Document = 3  Document::DocumentName = Instruction 2

           and we want to assign to it the ID of the parent document, the ParentDocument value list gives the following choices:

             
      •           Manual
      •      
      •           Instruction 1
      •      
      •           Instruction 2

            

           Is there any way to prevent the current record ID value from being listed?

           Thanks

            

        • 1. Re: Removing current ID from value list
          philmodjunk

               Use a conditional value list. The relationship for the conditional value list can use the ≠ operator so that the relationship matches to all records except the one with the current records id.

          • 2. Re: Removing current ID from value list
            NaturSalus

                 Hello Phil,

                 I implemented it. Thanks for the tip. 

            • 3. Re: Removing current ID from value list
              NaturSalus

                   Hello Phil,

                   Although the use of a conditional value list works perfectly well and allows selection based on the document's hierarchy, it is not user friendly when you have to choose a document record out of hundreds. That is the reason why I rarely use a value list to select values from a large list.

                   Since I always use your portal based picker set up (enhancedvalueselection 2/6/2012) when in need to select a value out of hundreds I wonder if it could be implemented in my case. So far I have used it  both in the Parent --< Child and Parent --< Parent|Child >-- Child cases. However I am not sure how to use it in my current situation and being able to rule out from the selection list  both the current record and the records with a lower hierarchy than the current one.

                   Your feedback is, as always, appreciated.

                   Thanks

              • 4. Re: Removing current ID from value list
                philmodjunk

                     I'm not sure how you would filter out the "Lower hierarchy" records but a portal can certainly filter out the current record with much the same expression that I used to describe the relationship.

                • 5. Re: Removing current ID from value list
                  NaturSalus

                       Hello Phil,

                       The standard portal filter to show all the records in the picker is:

                       IsEmpty (Selection_DocumentForDocument::gSearchDocument)  or PatternCount( Selection_DocumentForDocument::DocumentName ;Selection_DocumentForDocument::gSearchDocument)

                       So in order to filter for the current record I erroneously thought that all I needed was to add:

                       IsEmpty (Selection_DocumentForDocument::gSearchDocument)  or PatternCount( Selection_DocumentForDocument::DocumentName ;Selection_DocumentForDocument::gSearchDocument) and Document::__kp_Document ≠ DocumentValueList::__kp_Document

                       or alternatively:

                       IsEmpty (Selection_DocumentForDocument::gSearchDocument)  or PatternCount( Selection_DocumentForDocument::DocumentName ;Selection_DocumentForDocument::gSearchDocument) and Document::__kp_Document ≠ Selection_DocumentForDocument::__kp_Document

                       But it doesn't work

                       Could you give me a hand on what addtional restriction should I add to the filter?

                        

                       Thanks

                        

                        

                  • 6. Re: Removing current ID from value list
                    philmodjunk

                         I'm not sure which table occurrence name is the layout's and which the portal's but....

                         Try enclosing the first two terms in parenthesis  (term1 or term2 ) and term3

                    • 7. Re: Removing current ID from value list
                      NaturSalus

                           Hello Phil,

                           That was it!

                           Many thanks