retrieve items from list and convert (ODBC)

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf retrieve items from list and convert (ODBC)

Viewing 6 reply threads
  • Author
    Replies
    • #73997
      Jim Kosloskey
      Participant

        Doug,

        OK to start with the xlateOutVals in this example

        {{{2011-04-01 10:00:26.000} {2004-01-20 08:39:06.000} 154 1864}}

        is a nested list (I think you tried too hard to make xlateOutVals a list).

        The first nest only has one element and it is:

          {{2011-04-01 10:00:26.000} {2004-01-20 08:39:06.000} 154 1864}

        The above is what I think you really want but to continue…

        The second nest is:

           {2011-04-01 10:00:26.000} {2004-01-20 08:39:06.000} 154 1864

        within this nest is another set of lists (the 2 date/time elements) which have 2 elements each.

        In order to get the date you want you first have to properly navigate the list you have set up. I would suggest trying to reduce the nesting (share your code and perhaps we can assist with getting that pared down).

        Once you get to the date portion of the date/time element (index 0 of that list) you will get something like 2011-04-01.

        Then use the clock command.

        set junk [clock format [clock scan “2011-4-01”] -format %Y%m%d]

        The litreral with the date above will be replaced with the appropriate lindex once we get your list cleaned up.

        email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

      • #73998
        Doug Stelley
        Participant

          here is a snippet from the SQL command:

          set xlateOutVals

            ]

            Thats what produced the

            {2011-04-01 10:00:26.000} {2004-01-20 08:39:06.000} 154 1864

            I was able to get the “154” by using

            set myloc [lindex [lindex [lindex $xlateOutVals 0] 0] 2]

            However I was not able to use “myloc” in a later COPY command.

            I’m looking for examples on creating something along the lines of

            set xlateOutVals 0 to be the first date

            set xlateOutVals 1 to be the second date

            set xlateOutVals 2 to be the “154”

            set xlateOutVals 3 to be the ‘1864″

            Internal to the proc it was easy, how de I bring them forward?

            I haven’t looked at the clock portion yet….

            Thanks!

          1. #73999
            Doug Stelley
            Participant

              It would like be easier to program a seperate proc for each ODBC call

              and have them be in seperate COPY commands but I thought it would be more efficient to bundle them up.

            • #74000
              Doug Stelley
              Participant

                for the clock portion;

                using

                set clock1  [lindex [lindex [lindex $xlateOutVals 0] 0] 1]

                set junk [clock format [clock scan $clock1] -format %Y%m%d]

                echo myclock:

                here is the message:

                MESSAGE 1

                Tcl callout error

                erroCode: NONE

                errorInfo:

                unable to convert date-time string “2004-01-20 08:39:06.000”

                   while executing

                “clock scan $clock1”

              • #74001
                Jim Kosloskey
                Participant

                  Doug,

                  I have created multiple outbound from one inbound in the past by using xmpstore.

                  With that technique, I needed to use a CALL Action in the Xlate to invoke the proc rather than a COPY Action.

                  email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                • #74002
                  Jim Kosloskey
                  Participant

                    Doug,

                    You only need to use the date portion for what you want.

                    The date/time is a list in and of itself so you can lindex into that list as well.

                    For example

                    set clock1  [lindex [lindex [lindex $xlateOutVals 0] 0] 1]

                        at this point you have {2004-01-20 08:39:06.000}. This is a list. Now you only really need the first element of the list (2004-01-20). So if you do this:

                    set junk [lindex $clock1 0]  <– this should give you just the 2004-01-20

                    Or you could just increase your indexing above to get the same thing.

                    Now do your clockformat/clockscan with the junk or clock1 variable (whichever indexing method you used).

                    email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                  • #74003
                    Keith McLeod
                    Participant

                      The command does not handle the .000 at the end of the time.

                  Viewing 6 reply threads
                  • The forum ‘Cloverleaf’ is closed to new topics and replies.