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

<cfset FORM.UnitsProd = FORM.EndUnits - (FORM.StartUnits) + 1 >

Participant ,
Sep 29, 2009 Sep 29, 2009

Copy link to clipboard

Copied

Good morning all,

I am having a problem with this formula. <cfset FORM.UnitsProd = FORM.EndUnits - (FORM.StartUnits) + 1 >

When FORM.StartUnits = 1 then, my calculations are wrong. For instance, EndUnits and StartUnits represent serial numbers, which I can then, total as UnitsProd. If EndUnits = 3 and StartUnits = 1; I get 3 = 3-1+1. But, 15 = 60 - 46 +1. Would a cfif statement resolve this?

<cfset FORM.UnitsProd = FORM.EndUnits - (FORM.StartUnits) + 1 >

<cfif>

#FORM.StartUnits# = 1

<cfelse>

<cfset FORM.UnitsProd = FORM.EndUnits + FORM.StartUnits >

</cfif>

Does this make sense?

Thanks in advance,

DJ Khalif

TOPICS
Advanced techniques

Views

878

Translate

Translate

Report

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 ,
Sep 29, 2009 Sep 29, 2009

Copy link to clipboard

Copied

Does it make sense?  Not to me.

Maybe if you show us some numbers that include what you think the answer should be and what it actually is, it would more clear.

Votes

Translate

Translate

Report

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
Participant ,
Sep 29, 2009 Sep 29, 2009

Copy link to clipboard

Copied

Dan,

UnitsProd = EndUnits - StartUnits + 1, (3 = 3 - 1 + 1). This should be 4

But,

UnitsProd =EndUnits - StartUnits +1, (15 = 60 - 46 +1) This is correct.

I hope this helps.

Thanks,

DJ Khalif

Votes

Translate

Translate

Report

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
Guest
Sep 29, 2009 Sep 29, 2009

Copy link to clipboard

Copied

"UnitsProd = EndUnits - StartUnits + 1, (3 = 3 - 1 + 1). This should be 4"

I think you need to take your calculator back to the store - that's correct, it should be (and is) 3.

3 - 1 = 2

2 + 1 = 3

Or, to make it simpler, the "- 1" and "+ 1" cancel each other out, so it becomes:

3 = 3

Your app is running correctly, it's your verification calculations which are wrong.

Votes

Translate

Translate

Report

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
Participant ,
Sep 29, 2009 Sep 29, 2009

Copy link to clipboard

Copied

LATEST

Phil,

Thanks for the jab. However, I spoke too soon. As ugly as it looks it does work. I went back to look at the results and realized that; if I produced 1 unit then, my formula works properly. That's the basis for the whole thing. To put it plainly, I was trying solve what I solved.

Thanks,

DJ Khalif

Votes

Translate

Translate

Report

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
Resources
Documentation