6 Replies Latest reply: Jan 13, 2014 5:05 PM by horses60 RSS

    Call 2 pages from calendar

    horses60

      Hi all,

      I need to know if it’s possible call two different detail pages from a calendar page.

      Exemple:

      • In Page1 I manage the Table1; In Page2 I manage the Table2.
      • To build Page3 with the calendar I use this SQL statement:

      select ‘T1’, PK1, Date1, Description1

        from Table1

      union

      select ‘T2’, PK2, Date2, Description2

        from Table2

        order by 2


      If I click on an line of calendar with Description1 I want to go to Page1 and if I click on an line of calendar with Description2 I want to go to Page2.

      It’s possible?

      Many thanks.

        • 1. Re: Call 2 pages from calendar
          jrimblas

          Yup, you should be able to do this.  No problem.

          If you created an "Easy Calendar" make sure to convert it to a "SQL Calendar" (the option will be on the sidebar) so that you can specify your SQL with a union.

           

          I should have added, add your page number as a column in your SQL (for example PAGE_ID) then use the #PAGE_ID# substitution for the Page when you specify the link.  Then you can use the correct ID also in the parameters.  You may need to specify the item that's receiving the parameter also.

           

          For example:

           

          select 1 page_id
               , 'P1_ID' ITEM
               , pk1 PK_VALUE
               , date1  calendar_date
              , description1 desc
           from table1
          union all
          select 2 page_id
               , 'P2_ID' ITEM
               , pk2 PK_VALUE
               , date2  calendar_date
              , description2 desc
           from table2
          

           

          Then #ITEM# is the name of the item that receives the PK, #PK_VALUE# is always the ID that needs to come up on the destination page.

           

          Thanks

          -Jorge

          • 2. Re: Call 2 pages from calendar
            horses60

            Thanks for your help Jorge.

            Now I can call Page1 and Page2 by PAGE_ID, but if I cange the field name of Page1 from P1_PK_ID_TABLE1 in PK_ID and the field name of Page2 from P2_PK_ID_TABLE2 in PK_ID (same of Page1), I have this error:

            • Item name is already used by another application or page item.
            • 3. Re: Call 2 pages from calendar
              jrimblas

              You can leave the items with unique names P1 as P1_PK_ID_TABLE1 and P2_PK_ID_TABLE2 for P1.  I suggest you place those item names in your SQL as the name of the item ("ITEM" column in the sample SQL I posted previously)

              Then in the calendar when you define the link the "Set These Items" will use #ITEM# and the "With These Values" will say #PK_VALUE# (or whatever name you gave the PK column in the SQL.

               

              Hope this helps

              -Jorge

              • 4. Re: Call 2 pages from calendar
                horses60

                Sorry but I don't understand.

                This is my SQL statement:

                 

                select '20' as ID_PAGE, A.PK_ID_APPEL as PK, A.TXT_SUJET as TXT, A.DAT_APPEL as DAT

                  from TBL_APPELS A

                union

                select '10', T.PK_ID_TACHE, T.TXT_TACHE, T.DAT_DEBUT_TACHE

                  from TBL_TACHES T

                order by 4

                 

                The pages are 10 and 20 (IdPage) and I can call with #ID_PAGE#, I can also use #PK# for the parameter “With these values”, but how can I write the parameter “Set these items” if I have two different names in the two pages (Calendar attributes section>Column link)?

                • 5. Re: Call 2 pages from calendar
                  jrimblas

                  What I'm suggesting is that you add one more column to the SQL with the name of the destination item.  So, one will be on p10 the other on p20

                   

                  select '20' as ID_PAGE, A.PK_ID_APPEL as PK, A.TXT_SUJET as TXT, A.DAT_APPEL as DAT
                          , 'P20_ID' item
                  
                    from TBL_APPELS A
                  union
                  select '10', T.PK_ID_TACHE, T.TXT_TACHE, T.DAT_DEBUT_TACHE
                        , 'P10_ID' item
                    from TBL_TACHES T
                  order by 4
                  


                  Then on the "Set these items" you reference the COLUMN (#ITEM#) from the SQL and not the name of the item.

                   

                  Make sense?

                   

                  Thanks

                  -Jorge

                  • 6. Re: Call 2 pages from calendar
                    horses60

                    Thanks Jorge.

                    It was very easy to understand....after reading....