Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

text endtext in Core dialect 19 Mar 2022 15:01 #21991

  • wriedmann
  • wriedmann's Avatar
  • Topic Author


  • Posts: 3297
  • Hi Robert,
    specially when combining SQL, JSON or XML statements, something like the TEXT ... ENDTEXT functionality in VFP dialect would help to make code clearer. The text I need includes newlines and " character.
    Is there something I can use in Core dialect?
    Thank you very much!
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    text endtext in Core dialect 19 Mar 2022 17:39 #21992

    • robert
    • robert's Avatar


  • Posts: 3446
  • Wolfgang,
    At this moment TEXT .. ENDTEXT is only available in the FoxPro dialect.
    But we actually already have a request to add support for it to other dialects.
    github.com/X-Sharp/XSharpPublic/issues/977
    And in that case the most obvious location would either be the core dialect or in all non core dialects.
    I will see what I can do here.

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    text endtext in Core dialect 19 Mar 2022 17:44 #21993

    • wriedmann
    • wriedmann's Avatar
    • Topic Author


  • Posts: 3297
  • Hi Robert,
    thank you very much, that would help a lot!
    I could use that feature not only constructing SQL, XML and Json, but also for XAML.
    Such a piece of code is not very easy to write and to read:
    oSB := System.Text.StringBuilder{}
    oSB:AppendLine( e"<DataTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">" )
    oSB:AppendLine( e"<Grid  VerticalAlignment=\"Center\" HorizontalAlignment=\"Left\" Background=\"#ececec\">" )
    oSB:AppendLine( e"<Grid.RowDefinitions>" )
    oSB:AppendLine( e"<RowDefinition Height=\"Auto\"/>" )
    oSB:AppendLine( e"</Grid.RowDefinitions>" )
    oSB:AppendLine( e"<Grid.ColumnDefinitions>" )
    oSB:AppendLine( e"<ColumnDefinition Width=\"Auto\"/>" )
    oSB:AppendLine( e"<ColumnDefinition Width=\"Auto\"/>" )
    oSB:AppendLine( e"</Grid.ColumnDefinitions>" )
    oSB:AppendLine( e"<TextBlock Margin=\"20,5,5,1\" " + cFontProperties + e" Text=\"Auftrag : \" Grid.Row=\"0\" Grid.Column=\"0\" />" )
    oSB:AppendLine( e"<TextBlock Margin=\"1,5,5,10\" " + cFontProperties + e" Text=\"{Binding DraggingRecords[0].DraggingBeschreibung}\" Grid.Row=\"0\" Grid.Column=\"1\"/>" )
    oSB:AppendLine( e"<TextBlock Text=\"Ziel : \" Grid.Row=\"1\" Grid.Column=\"0\"/>" )
    oSB:AppendLine( e"<TextBlock Text=\"{Binding DragStatus}\" Grid.Row=\"1\" Grid.Column=\"1\"/>" )
    oSB:AppendLine( e"</Grid>" )
    oSB:AppendLine( e"</DataTemplate>" )
    oStringReader := System.IO.StringReader{ oSB:ToString() }
    oXmlReader := System.XML.XmlReader.Create( oStringReader )
    oDataTemplate := ( DataTemplate ) System.Windows.Markup.XamlReader.Load( oXmlReader )
    _oPlanungGrid:RowDragDropTemplate	:= oDataTemplate

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    text endtext in Core dialect 19 Mar 2022 19:37 #21995

    • robert
    • robert's Avatar


  • Posts: 3446
  • Wolfgang,
    Here is the reference to the TEXT .. ENDTEXT command
    www.xsharp.eu/help/command_text.html
    In the core dialect we can create the string and evaluate the expressions (between << and >>) when the TEXTMERGE keyword is used.
    These expressions work like interpolated strings. The FoxPro TEXT command also outputs to a file (when set alternate is on). We can't do that in the core dialect.

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    text endtext in Core dialect 20 Mar 2022 07:08 #21998

    • wriedmann
    • wriedmann's Avatar
    • Topic Author


  • Posts: 3297
  • Hi Robert,
    yes, I had looked at the help before writing.
    IMHO it would be enough to have a possibility to write such long expressions to a string variable - variable substitution can be done later, it is really an easy thing.
    When output to a file is needed, it is IMHO better to use later one of the relative functions in the System.IO namespace. They give much more control.
    It is really important that things like newlines, apostrophes and parentheses can be used inside this string without too much masking needed (masking makes the expressions hard to write and, more important, hard to write).
    I'm writing so much code everyday that is really important to be able to read and understand it later very fast.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1