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

Using "+" with getField("num.CD.BPAC.01").value;

Engaged ,
May 18, 2023 May 18, 2023

When is it appropriate to use the + sign with getField? I have seen it written these two ways and both seem to work the same:

     var num = getField("num.CD.BPAC.01").value;

and

     var num = +getField("num.CD.BPAC.01").value;

TOPICS
JavaScript
1.4K
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
1 ACCEPTED SOLUTION
LEGEND ,
May 19, 2023 May 19, 2023

The result is often the same, but consider what happens if you type 0001. 

getField("num.CD.BPAC.01").value, put back in another field, gives you "0001".

+getField("num.CD.BPAC.01").value gives you "1".

View solution in original post

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 ,
May 18, 2023 May 18, 2023

+ will get value as number.

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
Engaged ,
May 18, 2023 May 18, 2023

Thank you, that makes sense. 

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
LEGEND ,
May 19, 2023 May 19, 2023

The result is often the same, but consider what happens if you type 0001. 

getField("num.CD.BPAC.01").value, put back in another field, gives you "0001".

+getField("num.CD.BPAC.01").value gives you "1".

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
Engaged ,
May 19, 2023 May 19, 2023
LATEST

Thank you for this clarification, of which I was unaware, but important to understand.

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