Gravity concatenate

  1. 6 years ago

    Joel_Eisenstat

    14 Aug 2017 User since 2016

    Good morning ,
    Having a confusing time trying to figure concatenation in Gravity for string var, although likely it is
    quite simple. Going up the C route strcat and various operators isn't working thus far so any hints are appreciated.
    The end goal is to have a text ' formatter' using string functions and markdown.
    Regards,
    Joel

  2. marco

    14 Aug 2017 Administrator User since 2016

    The + operator is used for string concatenation. For example

    var s = "Hello " + "World";
    Console.write(s);
  3. Joel_Eisenstat

    14 Aug 2017 User since 2016

    Thanks - I will try that ( not at my workstation) but seem to recall that was a problem with ;
    var a = '' ~~"
    noteText.text = a + noteText.text +a ;
    for a markdown format.
    Thanks
    Joel

  4. Joel_Eisenstat

    14 Aug 2017 User since 2016

    Odd when I drop .text the the markdown is ;
    CREOTextView <0x7fc4fa410260> [contentSize={327, 221},insets={0, 0, 0, 0}] [subviews=3] with the strike thru applied. ( not seen by copy paste)
    while when .text is used the result is ;
    ~~Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore
    The markdown operator is not applied.

  5. marco

    16 Aug 2017 Administrator User since 2016

    Can you please send me a sample project that shows the issue?

  6. Joel_Eisenstat

    16 Aug 2017 User since 2016

    Thanks Marco - figured it out , the default text of the control was the problem . Not sure why.
    By removing it and default to 'blank' the code worked like a charm , Pick list for markup on the text .
    Next is to try it on a section of text as opposed to the complete text.
    Regards,
    Joel

  7. Joel_Eisenstat

    17 Aug 2017 User since 2016

    Hi Marco,
    Spoke too soon and/or jinxed myself. I think there a problem with markup parser or TextView. When the
    code was transferred from the test bed (which worked) to the main project the text wasn't 'interpreted' for the markup. The text returned < ~~I really like Ants ~~ > while the console log returned <
    ~~I really like Ants
    ~~ > which has a lot of padding. I cannot account for the blank space.
    Any comments are appreciated.
    Joel

  8. marco

    18 Aug 2017 Administrator User since 2016

    @Joel_Eisenstat do you have a Creo project?

  9. Joel_Eisenstat

    18 Aug 2017 User since 2016

    This works when there are no spaces in the TextView otherwise
    markup doesn't .

  10. marco

    20 Aug 2017 Administrator User since 2016

    @Joel_Eisenstat I am sorry but I don't understand what are you trying to do.
    Can you please explain to me where the issue is?
    Thanks.

  11. Joel_Eisenstat

    21 Aug 2017 User since 2016

    Medical records cannot be altered or erased ( no whiteout or pencils ) so a pen cross out is required. I am attempting the electronic equivalent using strikethrough in markdown. Once I was applying the markdown parser a PickerView was used to offer a few text manipulations.
    The problem seems to there is padding/blank spaces added to the text in a TextView messing up the markup parser . Instead of applying the markup i.e. strikethrough , the string literal is kept . ~~example text ~~.
    I cannot find the cause of these spaces , but it seems associated with TextView.
    Joel

  12. marco

    22 Aug 2017 Administrator User since 2016

    If I enter some text in the noteText field and then I change the PickerView1 control then the text is successfully changed and everything seems to correctly work. Am I missing something?

  13. Joel_Eisenstat

    22 Aug 2017 User since 2016

    Yes the small test app seems to work but when I transfer the code to the main project if fails as I described above . I'll keep hunting it down. Some debugging tools to the log would be quite helpful.
    BTW I haven't the time but the new gesture class is quite exciting and look forward to using it.

  14. marco

    23 Aug 2017 Administrator User since 2016

    Do you have a way to reproduce the incorrect behaviour?

  15. Joel_Eisenstat

    25 Aug 2017 User since 2016

    In the TextView if there are spaces between lines the behaviour is reproduced.

  16. marco

    25 Aug 2017 Administrator User since 2016

    @Joel_Eisenstat thanks a lot for the hint!
    We was able to fix the issue and we'll post an update soon.

  17. Joel_Eisenstat

    2 Sep 2017 User since 2016

    Good morning,
    There seems to be ongoing issues with TextView and markup.
    Spaces/padding between sentences is lost when markup is applied.
    Also the markup notation e.g. ~~ is lost when saving the record.
    ~~markup~~ will give the strikethrough in TextView calculated by
    string+noteText.text+string .
    However when saving< noteText.text =string+noteText.text+string >the markup strings are somehow lost from the string, thus the markup is not kept in the note.
    Regards
    Joel

  18. marco

    3 Sep 2017 Administrator User since 2016

    It is lost during savings (is a PostgreSQL database I guess) because probably PG tries to interpret that characters and so they should be escaped in some way in order to preserve them.

    For the issue "Spaces/padding between sentences is lost when markup is applied" do you have a sample project to send me?

  19. Joel_Eisenstat

    19 Sep 2017 User since 2016

    Good morning,
    Took another approach, added "markdown type" column and applied when opening record. Works well and easier than playing with escape codes. Will provide an example for the space/padding issue with TextView later this week.

or Sign Up to reply!