Datum aus Feld richtig übernehmen

Startseite Foren Deutsches LiveCode-Forum Datum aus Feld richtig übernehmen

Ansicht von 4 Antwort-Themen
  • Autor
    Beiträge
    • #28525
      ASNCM
      Teilnehmer

        Hallo zusammen.

        Ich habe einen Code der wie folgt aussieht:


        if Fld"Tour">0 then
        if auswahl = "ABGLEICH" then
        set the URL of widget "Browser" to "http://" & fld "ss" & "/cgi-bin/report_inbound_ofd.cgi?doAction=true&reportType=simple&stimestamp_from=2021-05-10+00%3A00%3A00&stimestamp_till=2021-05-10+23%3A59%3A59&tour=" &Fld "tour"
        show widget "Browser"
        put "ABGLEICH" into field "ueber"
        end if
        else
        if auswahl = "ABGLEICH" then
        set the URL of widget "Browser" to "http://" & fld "ss" & "/cgi-bin/report_inbound_ofd.cgi?doAction=true&reportType=simple&stimestamp_from=2021-05-10+00%3A00%3A00&stimestamp_till=2021-05-10+23%3A59%3A59&tour=-1"
        show widget "Browser"
        put "ABGLEICH" into field "ueber"
        end if
        end if

        nun werden in 2 Felder:
        Datum von: 10.05.2021 (Feldname: davon)
        Datum bis: 10.05.2021 (Feldname: dabis)

        Wie kann ich nun die die Variable in dem Code so eingeben, dass die Daten auch so angezeigt werden:
        „2021-05-10“

        Danke für die Hilfe.

      • #28947
        Klaus Major
        Administrator

          Hallo ASNCM,

          willkommen im Forum!
          Tut mir leid, aber es gibt immer noch Probleme mit dem automatischen Freischalten von Postings.

          1. Ganz wichtig, beim Zusammensetzen von Namen, Dateipfaden und auch URLs immer KLAMMERN verwenden, sonst kommt LC schon mal durcheinander, also:

          ...
          set the URL of widget "Browser" to ("http://" & fld "ss" & "/derrestdannhier.html")
          ...

          Ich bin nicht sicher, ob ich verstehe, was Du willst…
          Du hast zwei Felder mit Inhalt:
          Datum von: 10.05.2021 (Feldname: davon)
          Datum bis: 10.05.2021 (Feldname: dabis)
          Und diese beiden Daten möchtest Du in der URL unterbringen aber im Format 2021-05-10.
          Ist das korrekt?

          Wenn ja, dann geht es so:

          ...
          put fld "davon" into tVon
          put fld "dabis" into tBis
          ## Nun ins gewünschte Format umwandeln:
          set itemdel to "."
          put item 3 of tVon & "-" & item 2 of tVon & "-" & item 1 of tVon into tVon2
          ## item 1 = 2021, item 2 = 05, item 3 = 10
          ## tVon -> 2021-05-10
          
          put item 3 of tBis & "-" & item 2 of tBis & "-" & item 1 of tBis into tBis2
          ## Dito, tBis -> 2021-05-10
          
          ## Jetzt die beiden Variablen in die URL einbauen (String zusammensetzen):
          ...
          ## if...
          set the URL of widget "Browser" to ("http://" & fld "ss" & "/cgi-bin/report_inbound_ofd.cgi?doAction=true&reportType=simple&stimestamp_from=" & tVon & "+00%3A00%3A00&stimestamp_till=" & tBis & "+23%3A59%3A59&tour=" & Fld "tour")
          ...

          Gruß

          Klaus

        • #28949
          Klaus Major
          Administrator

            Zum besseren Verständnis hier mal in lang:

            ...
            put "http://" into tURL
            put fld "ss" AFTER tURL
            put "/cgi-bin/report_inbound_ofd.cgi?doAction=true&reportType=simple&stimestamp_from=" AFTER tURL
            put tVon AFTER tURL
            put "+00%3A00%3A00&stimestamp_till=" AFTER tURL
            put tBis AFTER tURL
            put "+23%3A59%3A59&tour=" AFTER tURL
            put Fld "tour" AFTER tURL
            set the URL of widget "Browser" to tURL
            ...
          • #28970
            ASNCM
            Teilnehmer

              Hallo.

              hat geklappt.
              Vielen Dank.

              habe aber in der URL „& tVon & „+00%3A00%3A00&stimestamp_till=“ & tBis &“
              auf „& tVon2 & „+00%3A00%3A00&stimestamp_till=“ & tBis2 &“ abändern müssen, damit es funktioniert.

              Aber alles super !
              Vielen Dank.

            • #28979
              Klaus Major
              Administrator

                Ach ja, sorry, made in Eile und so… 😀

            Ansicht von 4 Antwort-Themen
            • Du musst angemeldet sein, um auf dieses Thema antworten zu können.