Ask Me Anything: TextExpander Fill-Ins

Hi, Tamaryn, here are a couple of videos that you may find helpful. Date/time macros always expand the current date and time, but you can use date math macros to adjust them.

@josh.centers I am not sure what you meant. Here is a short video with the issue. - VIDEO

@AlexBainov I noticed a few hardcoded line breaks, meaning there are empty lines that are probably being retained. Does the issue persist if you remove them? (By the way, I’m a fellow T&E lawyer practicing out of Rochester, New York.)

I re-read your earlier reply and see that you’re already aware of the empty lines causing the problem.

One workaround is to add a fillpart with a name that just has a space, like this:

%fillpart:name=optional part 1:default=no%a%fillpartend%
%fillpart:name= :default=no%%fillpartend%
%fillpart:name=optional part 3:default=no%c%fillpartend%

A more elegant solution is to use nested snippets. Create a new JavaScript snippet that takes the content of the existing snippet and removes empty lines. This is working for me:

let input = `%snippet:your_existing_snippet%`;
let cleaned = input
  .split('\n')
  .filter(line => line.trim() !== '')
  .join('\n');

cleaned;
let strVSARefund = "[variable here that would be called VSARefund]";
let numVSARefund = parseFloat(strVSARefund);
let formattedVSARefund = numVSARefund.toLocaleString("en-US", { style: "currency", currency: "USD" });

let strPPMRefund = "[variable here that would be called PPMRefund]";
let numPPMRefund = parseFloat(strPPMRefund);
let formattedPPMRefund = numPPMRefund.toLocaleString("en-US", { style: "currency", currency: "USD" });

let strGAPRefund = "[variable here that would be called GAPRefund]";
let numGAPRefund = parseFloat(strGAPRefund);
let formattedGAPRefund = numGAPRefund.toLocaleString("en-US", { style: "currency", currency: "USD" });

let strTWRefund = "[variable here that would be called TWRefund]";
let numTWRefund = parseFloat(strTWRefund);
let formattedTWRefund = numTWRefund.toLocaleString("en-US", { style: "currency", currency: "USD" });

let result = `

VSA Refund: ${formattedVSARefund}
PPM Refund: ${formattedPPMRefund}
GAP Refund: ${formattedGAPRefund}
TW Refund: ${formattedTWRefund}

`;


result;



Thanks, @HaniSarji . I’ll try this out.

Thank you very much Alex!!

1 Like

@HaniSarji Tested this and it works great as a solution for me. Very creative/clever one. Thank you so much!! Appreciate it. I only added an additional \nso that still adds a line break after each description (but deletes extra blanks).

P.S. I will keep in mind for T&E for Rochester if ever have come across situations there. If you need any help in Manitoba, Canada, do not hesitate to reach out. If any other province, I have contacts in some other provinces, so do not hesitate to reach out if needed.

1 Like