Need help with basic math expression (addition)

Hi,

I’m able to write a dynamic expression to add up 3 separate values on one page of my app, however when I write an identical expression to do the same math operation on a different page, the input where the sum is to be shown is blank.

The below screen shot shows the expression which is working fine.

When I write this expression using different inputs, it doesn’t appear the these values are being summed as the product (Total Duration is 0) as shown in the screen shots below.

I know i am missing something small here, but just can’t seem to spot it.

Appreciate anyone’s help on this.

Thanks!

You set it in the placeholder but you should set this in initial content (or if this is just to display, in a text element instead

1 Like

Apologies,

I’ve edited the original post as I did not show the screen shot where i am having the issue and have shared it below:

What do you have when you inspect the total input in debug mode? (click on inspect, click on the input field and click on the initial content value on the left side. You will see the formula in the right side of debugger and you can inspect each part.

1 Like

This may be happening because the “Initial content” is loaded as soon as the component is rendered. If the information for the first inputs is being inserted afterwards, then the “Initial content” of that last input will indeed appear empty.

Are the values “1” in the first 3 inputs being entered manually after the page loads?

3 Likes

Weird, it does not show the formula at all

Maybe you can record a screencast so we can help you?

1 Like

Yes, the values “1” are entered manually after the Pop up is rendered, and the drop down (select activity) has an activity selected . I just entered 1 in each input to keep it simple.

Here is a shot of the Pop up once loaded:

I’ve then selected the activity from the drop down “Picking Cart”:

I then entered the values (1,2,3) for in the inputs as shown below. The input below Total duration should now be populated with the sum total:

Absolutely, appreciate the help btw!

Scroll down on left to see “initial value” field and you should be able to click on the 0 (value),

Record a screencast/video instead so we can follow what you are doing.(including test and debug/inspect and probably setting of your fields)

1 Like

The “initial value” field doesn’t appear, there is a field called “ initial content” , is that what you mean? Here’s the expression when I click on the 0 (Value)

Here’s the expression that actually works:

Do you have MS Teams? I can send you an invite

Initial content sorry. But you found it. You can now inspect each part on the right side (in blue, each part is clickable)

1 Like

Fixed it!!

I had to add the expression to the initial content on the inputs highlighted in yellow below.

The input circled in green is the correct total I was trying to achieve.

Thanks! and thank you @rpetribu

2 Likes