/ Forums / Advansys Formativ / Creating Solutions with Formativ / TRZDateTimeEdit and TRZListview

  • Creator
    Topic
  • #4301
    sfritz
    Participant

      Hi Advansys support,

      You are always full of good ideas, I took your suggestion and store out the item indices in my form and it does make my data retrieval much more efficient, I am still having to open multiple data connections and wonder if there is a more efficient method.

      My next question is I am storing out the month and the year for a date and when I retrieve this record to edit it I would like to set my TRZDateTimeEdit to this date but I keep getting this error:

      Could not convert variant of type (OleStr) into type (Double) at line 312, column 7

      Code snippet:
      t_mth = iRST_Edit(“month”)
      t_year = IRST_Edit (“year”)
      t_date = t_mth & “/01/” & t_year
      date_in = CDATE(t_date)
      t_date_sel = formatdatetime(date_in,1)
      CDIP_FRM.MonthEdit.date = t_date_sel

      Can you please tell me why?

      Next question is that I have my itemindex for my listview stored in the database as well but have not successfully been able to mark it as selected when retrieving my record into my form:

      Code snippet
      t_guideline = iRST_Edit(“guideline_idx”)
      with CDIP_FRM.ListView.Items
      for I = 0 to .Count – 1
      if .Item(I) = t_guideline then
      .Item(I).selected = TRUE
      end if
      next
      end with

      No syntax error.. no nothing!
      Any ideas?

    • Author
      Replies
    • #7764
      Support 1
      Participant

        quote:


        I would like to set my TRZDateTimeEdit to this date but I keep getting this error:

        Could not convert variant of type (OleStr) into type (Double) at line 312, column 7


        The above error message indicates that the RzDateTimeEdit property Date requires the type Double, where you are trying to assign a String. You could fix this by assigning date_in instead of t_date_sel. However, the formatted date string t_date (MM/DD/YYYY) could be problematic if your applet runs in a locale other than English-US. Here is an alternative, locale-independent way to retrieve the date:

          t_mth = iRST_Edit("month")
          t_year = IRST_Edit("year")
          CDIP_FRM.MonthEdit.Date = DateSerial(t_year, t_mth, 1) ' VBScript function

        As for selecting the correct ListView item, the expression

          if .Item(I) = t_guideline then

        is comparing a object reference (pointer) with a string. I think the complete if statement should be:

          if .Item(I).Caption = t_guideline then
            .Item(I).selected = true
            exit for
          end if

        I hope this helps.

        Regards,
        Advansys Support

      Viewing 1 replies (of 1 total)
      • You must be logged in to reply to this topic.