4 Replies Latest reply on Mar 23, 2014 12:03 AM by morganbleak

    Portal Filtering



      Portal Filtering


           I need a little help writing a calculation that will filter out unrelated records in a portal.

           My portal shows software key numbers and software version records that will pertain to an application.  Because the records are all from the same portal table I see the versions and keys in all of the photoshop, lightroom, etc., application records.

           I am thinking of a way like this:

           if ( Get ( ScriptParameter )  ≠ Software::_KP_Software_ID ; In this result area I don't know what to put that will show or not show the related records.

           Maybe I could use the Case function.

           I guess I don't know why this portal would be showing records from another record, it happens when I click on a button run by a script called "Add Line Item".

           The script is :

           Freeze Window

           Set Variable [$PrimaryKeySoft; Value:Software::_KP_Software_ID]

           Go to Layout ["Software Portal" (Software Portal)]

           // New Record/Request

           Set Field [Software Portal::_kf_Software_id; $PrimaryKeySoft]

           Go to Layout [original layout]

           Go to Field [Software Portal::Version Number]

           Go to Portal Row [Last]

           Exit Scrit []


           What I want it to do is to place the cursor in the portal's empty first box for quick entry of data, bringing the row up to be seen.  I did't use the "New Record/Request because it was giving me two rows.  It seemed to work but now I think it might be the reason when I enter on a another record that it is cutting a record from another one and placing it in the current record.  I hope I am explaining this so that it is understood.




        • 1. Re: Portal Filtering

               Portal filter expressions are Boolean. The expression is evaluated for each related record and the record is allowed to be visible in the portal if the expression evaluates as True for that related record. Thus, no If or Case function is needed in your example. And it doesn't really look like you need a portal filter expression at all.

               But Get ( ScriptParmeter ) only returns a value inside a script. It cannot be used in a portal filter expression.

               What can be used is this Relationship for your portal:

               LayoutTable::SelectedSoftwareID = Software::_KP_Software_ID

               Where you use the name of the table occurrence for the layout where you put your portal in place of "layout table". To select for different Software, put different values in the SelectedSoftwareID field. This can be by script or a value list.

          • 2. Re: Portal Filtering

                 Thanks Phil, I will give it a good run.  Wish I could keep this fresh in my mind and not make these relationship mistakes.  Part of learning and doing.



            • 3. Re: Portal Filtering


                   I was using a Primary Key from the Software Table =  Foreign Key from the Portal Table which carries the upgrade licenses. 

                   I have changed the relationship:


                   So, each new record I make in the Software Table, like photoshop will have the portal in it where I add the keys for the software as the software is upgraded.  The new software doesn't come all that often so I don't think I need value lists or scripts to keep track of software names.  I'll just make a new Software record.  But the portal Table will carry records of the Keys or license keys to the upgrades. 

                   With the above relationship change I now get one record accepted into the portal, the 2nd upgrade record as I click out of the Portal gives me the dialogue box which says that "the Portal record needs to have its unique ID, do you want to have it made in another layout? Revert the Record?"  This obviously means I have another problem, I am struggling to figure it out.

              • 4. Re: Portal Filtering


                     You won't need to answer the above, I figured out the relationships I needed and now the solution works well.

                     I had to make a join table to get it going.

                     Thanks for being available.