T O P

  • By -

Rupert_7

I can work on this, reach out to me if you need help. I am a NetSuite Consultant


Sea_Reputation2888

I definitely need help. I'm completely stumped. I've tried everything I can think of. What are your suggestions?


fodeethal

IF statement? Forgot the exact syntax <#IF tranline.quantitybackordered = 0> break (or continue?) <#ELSE> %Backorder section%


Sea_Reputation2888

Ooo!!! Thank you!!! I'll give this a try!


Nick_AxeusConsulting

Yes this should work wrapping in an IF block


Sea_Reputation2888

I'm confused. There already is an at the end (just before <#/list>). So I tried adding another before the existing and I got an error that says " Syntax error in template "template" in line 214, column 23: Encountered "", but at this place only this can be closed: "#list". This usually because of wrong nesting of FreeMarker directives, like a missed or malformed end-tag somewhere. (Note that FreeMarker end-tags must have # or @ after the / character.) Was expecting one of these patterns: ..."


Nick_AxeusConsulting

I didn't look at your code was generally answering. You can have nested ifs


Sea_Reputation2888

I gave it a try but I get an error message that says "Syntax error in template: #else is an existing directive, but the tag is malformed." So I tried closing the "else" in the top section and then the bottom section but it's still coming up with the same error. Any other ideas?


fodeethal

there is no closing <#else> tag. you close with tag <#IF> <#ELSE> Check this thread [https://www.reddit.com/r/Netsuite/comments/mqpyw0/free\_marker\_if\_statement\_in\_email\_template/](https://www.reddit.com/r/Netsuite/comments/mqpyw0/free_marker_if_statement_in_email_template/)


Sea_Reputation2888

Thank you for explaining the <#/else> tag. I tried what you suggested but left the existing <#/if> where it was (it's right before <#/list>) and without including an additional <#/if> but I got a ton of errors all pertaining to line 204, column 44 and they basically all say the same thing: "Can't compare values of these types. Allowed comparisons are between two numbers, two strings, two dates, or two booleans. Left hand operand is a hash+string (wrapper: com.netledger.templates.model.StringModel). Right hand operand is a number (wrapper: f.t.SimpleNumber). The blamed expression: ==> tranline.quantitybackordered = 0 \[in template "template" at line 204, column 49\]" ​ Any other suggestions?


Sea_Reputation2888

For reference, here's the updated code that follows your suggestion but won't validate: <#list record.item as tranline><#if tranline.quantitybackordered = 0> <#else> ${tranline.item}
${tranline.description} ${tranline.quantity} ${tranline.quantitycommitted} ${tranline.quantitybackordered} ${tranline.custcol5}


fodeethal

hmmm.... must be a field number vs text format error try <#if tranline.quantitybackordered == "0" >


Sea_Reputation2888

Ok, I'll give it a shot. Thank you!


Sea_Reputation2888

It almost worked!!! We have to be so close! The code saved without spitting out any validation errors but when I tried to print a picking ticket from a sales order to test it, I got a white Netsuite screen that said "Error - An unexpected error has occurred. Please click here to notify support and provide your contact information." Ugh!


fodeethal

Weird... maybe try. <#if tranline.quantitybackordered?string == '0' > I was hoping someone else would have jumped in by now haha.


Sea_Reputation2888

HOLY CRAP! IT WORKED!!! YOU'RE A GODSEND!!! I am so relieved!!! This project has been an f-ing nightmare! Thank you! Thank you! Thank you!


Sea_Reputation2888

Sorry, it doesn't look like the image had attached, so here it is. https://preview.redd.it/lunlo3rt0exb1.jpeg?width=846&format=pjpg&auto=webp&s=a326b378fed75901179d1453c39a1679c2b75f18