Jump to content
Server Maintenance This Week. ×

Is there a way to preserve String formatting in a script variable?


This topic is 767 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a script that builds an object that gets pasted into another application.

Over the years this objet has grown in complexity to the point where its a few hundred lines.    The problem I have is each time we update the object data I have to break it down line by line in filemaker with forced carriage returns and quotes inorder to preserve the formatting. 

 

Eg:

{ objType {

  ActionName{

    action-item-1: test

    action-item-2: test2

  }

}

becomes

{ objType {ActionName{action-item-1: testaction-item-2: test2}}}

 

as soon as the script is run.  Formatting seems to be preserved in the script itself but not upon variable assignment. 

 

Any ideas how I could get this done?

Edited by NickFaraday
Link to comment
Share on other sites

Could you provide a way (preferably a simple way) to reproduce this problem? I was not able to understand from your description what exactly do you start with and what do you do at the point where the carriage returns are lost.

BTW, the text you show looks very much like JSON - but it is not a valid JSON. With valid JSON the carriage returns (which are not essential) can be restored using the JSONFormatElements() function. But that's not an answer to why they are lost in the first place.

 

Link to comment
Share on other sites

That may just be a Line ending problem.

e.g. substitute($text; Char(13); Char(10))

e.g. FileMaker needs Char(13), but other apps may prefer Char(10).

And JSON usually escapes returns with \r in the text.

Edited by MonkeybreadSoftware
Link to comment
Share on other sites

This topic is 767 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.