ContributionsMost RecentMost LikesSolutionsRe: Changing Font Style/Size of CSV file @aditya.gupta41 - you need to have a serious talk with your Business Analyst. The requirement is nonsensical and there is no way for you to meet it. Text files are just straight textual data. CSV files add only minimal structure on top of that, i.e. they’re assumed to contain columnar data separated by a comma or other delimiter. There is no “font” or “font size” associated with a text or CSV file. Period. This requirement is like asking to adjust the wingtip style on a Toyota Celica. It’s a car. It doesn’t have any wings to have wingtips regardless of their shape. If they need a specific font, they need a different file format, such as Rich Text Format, Word document, or PDF. Hope this helps! Re: Inserting a line break while writing an excel file BTW, I saw you tried CHAR(10). Did you try char(13)+char(10)? Maybe just char(13)? Or the inverse, char(10)+char(13)? I’d try those – in that order – if you haven’t already. Re: Inserting a line break while writing an excel file Hi, @darshthakkar - I agree the Excel file format is a different story. And there has to be a way to embed linefeeds in a field there, else you couldn’t do it in Excel itself and get the line breaks back when you reopen the file later! I suggest if you don’t get an adequate answer in this forum, you check on a more general forum like Stack Exchange, and remove any references to SnapLogic. Just tell them you’re using an older version of JavaScript (not sure which one is embedded here, but I can find out if you really need it). Boil it down to just representing the line breaks in an Excel file (I guess you’re wanting .XLSX?), and how to get it in JavaScript. Then apply here! Re: Inserting a line break while writing an excel file Just my two cents worth here: you definitely do not want to try to embed newlines within the interiors of fields in a CSV file. Different programs parse CSV differently, but almost all of them treat the newline as an end-of-record terminator. That is, each line is a single record (regardless of using any quotiing or not). I realize this next statement is “painting with an overly wide brush”, but in general, CSV is an “okay but not great” data format for simple data interchange between systems, but NOT good for human-readable formatted data. Are you writing the formatted output as something like an XLSX file? You mentioned “flat file” several times, and Excel is not “flat” so I’m not sure here. (BTW, by “okay but not great” I mean that are better formats for data interchange too, but often CSV is “all you’ve got” and you make do.) Re: Math MOD function @nmuppa - you mentioned queries. Exactly what are you looking for here? “%” is the modulus operator in JavaScript, Ruby, and Python. If you really mean “queries,” which database system are you querying? Microsoft SQL Server uses the % operator as well, AFAICR. Oracle and PostgreSQL use a MOD() function. MySQL uses a dyadic MOD operator (dividend MOD divisor). Other DBMSes may use something entirely different, like “remainder”. Or did you really mean you want to implement a modulus function? From scratch? Re: Programmatically get SLPROPZ contents and write to a file Aha! I’ve finally cleared the Auth hurdle and getting a response from a REST GET snap. Now I just need to figure out how to transform the Base64-encoded $entity contents into binary before writing it to a file. Many thanks!! Re: Programmatically get SLPROPZ contents and write to a file Hi, Kory: A couple of questions:\\\\ actually just the 1 question… I found the Basic Auth in the documenttion! I’m an org admin, but I’d assume I don’t put my cleartext password in, right? Where do I get the password hash that I’d (presumably) use? Programmatically get SLPROPZ contents and write to a file Within a pipeline, how can I programmatically access the SLPROPZ file for a snaplex, and write the contents of the file out to the local hard drive? We have over 500 snaplexes that we need to do this for, so manually downloading them all is not a good solution. Also, for various reasons I won’t go into, we cannot employ an outside task that just pings each download endpoint. This HAS to be done from within a set of pipelines. The SnapLogic Metadata snaps give me the ability to list Snaplexes and to read them as a set of JSON attributes. But there seems no way to obtain (or reconstruct) the SLPROPZ file. Any help that can be provided will be much appreciated! Re: My sql execute snap In the future, if you have trouble with building a dynamic SQL string, here is a good trick to use. At least for testing, split your work into a Mapper Snap, then the Exec SQL snap. Build your string in the mapper snap and map it to something like $query. Then if you want to try executing it, have the SQL Snap simply execute $query with the [=] turned on. You can disable the SQL snap until you think you are ready. And then you can play with the expression that builds the string, using the mapper. This will let you see exactly the string you are building, and your errors will often be a LOT more obvious. You’ll notice this is what user @alchemiz did. Just my $0.02 of help. Re: Understanding router snap's functionality @darshthakkar, look at it this way. The router is sort of like a chain of ‘IF’ statements. Without “first match”, it’s like multiple “if’s” in a row, so that sending a document down the first Route doesn’t preclude routing it to, say, the third Route… if ( $doc.lastName == "Munster" || $doc.lastName == "Kolchak" ) route_to_path(doc, "Monster shows"); if ( $doc.lastName == "Kirk" ) route_to_path(doc, "SF shows"); if ( $doc.lastName == "Munster" || $doc.lastName == "Seinfeld" ) route_to_path(doc, "Comedy shows"); In the pseudocode above, if doc.lastName is “Munster”, a copy of the doc will be routed to both the “Monster shows” path and the “Comedy shows” path. Now, by turning on “First match”, you tell it “route the document only down the first Route where the Expression is true. Stop there and don’t route that document down other routes. If no route’s expression is true, just dump the document into the void.” That’s like putting an “ELSE” in front of each of the “IF” statements except the first. if ( $doc.lastName == "Munster" || $doc.lastName == "Kolchak" ) route_to_path(doc, "Monster shows"); else if ( $doc.lastName == "Kirk" ) route_to_path(doc, "SF shows"); else if ( $doc.lastName == "Munster" || $doc.lastName == "Seinfeld" ) route_to_path(doc, "Comedy shows"); If doc.lastName is “Munster” it will route to “Monster shows” and nothing else. It will never get to case number 3. If doc.lastName is “Forbin” it won’t match any of the expressions, and the doc won’t be routed anywhere – it will just evaporate. Okay, so why does @alex.panganiban.guild recommend using “First match” and setting the last item to “true”? Can’t we just say $ID == 130 and $ID != 130 ?? Well, we can. But we’d rather not. To see why, convert it to pseudocode again: if ( $ID == 130 ) route_to_path(doc, "130 path"); if ( $ID != 130 ) route_to_path(doc, "Everything else path"); That works fine. Then some other developer comes along and sees that the values “42” and “153” also need special processing. Let’s say they’re OCD and they put everything in numerical order: if ( $ID == 42 ) route_to_path(doc, "42 path"); if ( $ID == 130 ) route_to_path(doc, "130 path"); if ( $ID == 153 ) route_to_path(doc, "153 path"); if ( $ID != 130 ) route_to_path(doc, "Everything else path"); Whoops! ID’s 42 and 153 continue to be routed down the “Everything else” path in addition to their own new paths. Now, let’s turn on “First match” and lets put the last expression as simply true . We get: if ( $ID == 42 ) route_to_path(doc, "42 path"); else if ( $ID == 130 ) route_to_path(doc, "130 path"); else if ( $ID == 153 ) route_to_path(doc, "153 path"); else if ( true ) route_to_path(doc, "Everything else path"); This does what we want, and avoids future bugs when the snap gets changed. And else if ( true ) is just a different way of saying else . You do not want “First match” if you need to route the same document down multiple paths. For a contrived example, suppose the documents refer to people, and you have special processing of one type for married-vs-single, and some other kind of processing for male-vs-female. That’s 4 different routes, and a copy of each doc will always be routed down exactly two of those paths (assuming all docs are only male/female and married/single). Hope this helps!