Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

before statement

Community Expert ,
Jul 27, 2020 Jul 27, 2020

I'm getting missing before statement, Do I need to separate +*  and how do I do it?

event.value = Number(this.getField("field").valueAsString)"+"+*6+"%";

 

TOPICS
Acrobat SDK and JavaScript
1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 27, 2020 Jul 27, 2020

What are you trying to achieve, exactly?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 29, 2020 Jul 29, 2020

Sry for late reply. I want value to show like this '+6%' but can't add + sign infront of *6 calculation.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 29, 2020 Jul 29, 2020

Want you display '+6%' or want add 6% of the value?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 29, 2020 Jul 29, 2020

I want it to display '+6%'

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 29, 2020 Jul 29, 2020

Use this:

event.value = this.getField("field").valueAsString + "+6%";

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 29, 2020 Jul 29, 2020

field uses value from another field so it need to be *6+ "%" I just need + sign to appear in front of result,it should look something like this "+"+ *6+ "%" but it says missing before statement.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 29, 2020 Jul 29, 2020

You wrote:

> I want it to display '+6%'

That's what my code does. I don't understand what you're asking for now.

Bottom line is that everything that you want to add to the value of the field as text needs to be in double-quotes, preceded by a + sign. If you want to include double quotes (or a back-slash) in the string, they have to be preceded by a back-slash.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 29, 2020 Jul 29, 2020

Number is not static it's calculated from another field, I just used 6 as example, sry I should have mention that.

Anyway I managed to get it work with var x like this "+" + x*6+ "%". But would like to know if it's possible without var? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 29, 2020 Jul 29, 2020
LATEST

What is the value in x?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines