4 Replies Latest reply on Apr 14, 2015 4:03 PM by philmodjunk

    Dynamic button with next date as text

    TomTreiman

      Title

      Dynamic button with next date as text

      Post

      I have tblSchedule with a series of dates(of upcoming tasks and whether they are marked done)

      I would like to create a button that has as its label the data of the next not done task. (i.e.. fieldTaskDate >= CurrentTimestamp and filedDone = "False"). When the button is pressed I would like to open a new layout of a related table (tblHeader) for that task (i.e. with foreign key, tblHeader::ScheduleUID == tblSchedule::ScehduleUID)

      Any help out there?

      Thanks!!

        • 1. Re: Dynamic button with next date as text
          philmodjunk

          You can do this via a self join relationship or ExecuteSQL query.

          tblSchedule-----<tblSchedule|Next   (these are two occurrences of the same table

          tblSchedule::cToday > tblSchedule|Next::TaskDate AND
          tblSchedule::constFalse = tblSchedule|Next::FieldDone

          Double click the relationship line linking these two and specify a sort order that sorts tbleSchedule|Next records by TaskDate in ascending order to make sure that the most recent incomplete task with a date on or after today is the first related record.

          cToday would be an unstored calculation field set to return a Date with Get ( CurrentDate ) as its expression.
          constFalse would be a calcluation that always evaluates a false with the same return data type as FieldDone's data type.

          • 2. Re: Dynamic button with next date as text
            TomTreiman

            Next dumb question...

            I set up the relationships as in your example

            A simple layout based on table ScheduleNext still shows lots of copies of the same record. Is this right?

            A more complicated layout (where I'm trying to do the button) seems to still show all the records.

            Ideas on what I'm doing wrong?

            Thanks!

            • 3. Re: Dynamic button with next date as text
              TomTreiman

              Actually the relationships graphic is out of date. I tried taking out the ScheduleUID == ScheduleUID line.

              • 4. Re: Dynamic button with next date as text
                philmodjunk

                What I am describing would not use a layout based on ScheduleNext. You'd use one based on either Schedule or Header ( with a portal to schedule).