Trying to do a calculation with a Choice field and Decimal in Cognito Forms

I’m trying to make a calculation with a selected value in a choice field in combination with 2 other Integer fields. I created the following code:

`Calculation 1 = a text type Choicefield = a dropdown/with several predefined values Value 1 = a Integer Type number field   =(if Choicefield ="Choice1" and Value1 <3 then 72 * Value1 else if     Choicefield = "Choice1" and Value1  >2 and Value1 <5 then Value1 * 67.5 else if  Choicefield = "Choice1" and Value1 >4 and Value1 <10 then Value1 * 63 else if   Choicefield = "Choice2" and Value1 <3 then 80 * Value1 else if  Choicefield = "Choice2" and Value1 >2 and Value1 <5 then Value1 * 75 else if  Choicefield = "Choice2" and Value1 >4 and Value1 <10 then Value1 * 70   So on for the other choices..... else "")` 

I have a second calculation field:

Calculation 2 = a number type Value2 = a Integer type Number field =Value2 * 0.35 

In my last field I want to add the values from Calculation 1 and Calculation 2 together:

Calculation 3 = a Number Type =Decimal.Parse(Calculation 1) + Calculation 2 

The issue exists when trying to multiply with the decimal value 67.5 in my first calculation. As you can see if I enter 3 in my value1 field the calculation would be 67.5 * 3 = 202,50 however, in my third calculation field “2.025,00” is shown instead of 202,50. How do I calculate with decimals in my first calculation field so the correct price is shown in my final calculation (3) field?

Cognito forms – Age at January the First

Calculating Age in Cognito Forms.

Age in Years

= DateTime.Today.Year – BirthDate.Year + ( if DateTime.Today.Month < BirthDate.Month or (DateTime.Today.Month = BirthDate.Month and DateTime.Today.Day < BirthDate.Day) then -1 else 0)

This way we can calculate the age today, what about if i need to calculae the age, in years, at January the 1st 2019?

Thank you for all the help

Cognito Export Missing Columns

I have a rather “large” Cognito Form for Inventory and I’ve noticed that the export gives me an error message saying, “We found a problem with some content in ‘[File name].xlsx. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.” When I click ‘Yes’ everything seems to be okay but I was worried about data being missing. When I contacted Cognito support, they sent me a text file of all of the columns that are missing. These are columns I can see inside of Cognito but cannot see in my export. Is there any way to do an export or anything else that would include these files by chance?

Note: I have the “Select All” box checked on the columns menu.

Why have Cognito forms stopped working?

All of my Cognito forms have stopped working, bad time given the time of year. I am also not able to contact them as no contact details appear. The only information that is displayed for Cognito is an error:
“This site can’t provide a secure connection sent an invalid response. ERR_SSL_PROTOCOL_ERROR”.

No notifications have been sent either. Is anyone else experiencing this problem?

How do you place a quote inside a string on Cognito Forms calculations?

Cognito form allows for text calculation. But how do you put the ” character inside a string that is defined with quotes?

This is a very common problem in all programming languages, typically, there will be something called an escape character that is placed before the quote character so that it can be in the sting.

Here is an example of an escape character being used.

"This is a string with a \" character" 

How is this accomplished in Cognito Forms calculations?

Is this the correct way to use AWS Cognito?

I am doing the following in my React/Node App:

  1. Using the User Pools for a Cognito App that I have created
  2. Calling the /login endpoint with response_type=token in my React App
  3. Once I receive the JWT token, I pass it to my node/express server in a header (my server is using ssl)
  4. On the Node server, using cognito-express package to call cognitoExpress.validate(accessTokenFromClient, callback) to validate the token
  5. If the call is successful, saving the user details (email etc) and the jwt in localStorage in the React App

And then, for every call to my server, I am repeating steps 3 and 4 above (validating jwt) to ensure that the user is Authenticated.

My concerns with the above approach is:

  1. I am unsure if the cognito-express is actually calling Cognito, or is it just decoding the jwt and making a decision on its validity locally

  2. I tried leaving the session open overnight, and I expected that the call to cognitoExpress.validate(accessTokenFromClient, callback) would fail (because the jwt expires in a hour), but it didnt. Does this mean that an expired jwt token is considered as a valid claim

  3. If the user was Authenticated and his JWT has expired, how do I refresh the JWT without asking him to login again?