why can I not connect a variable to a single line text box?

  • 18 March 2019
  • 1 reply
  • 18 views

Badge +4

hi all, 

 

I am just trying to do something relatively simple but i've obviously done it wrong (again) so seeking your assistance to identify the issue.

 

I have a form with two datetime type controls called StartDate (which is 'connected to' the list column StartDate) & EndDate (which is 'connected to' the list column EndDate).

 

I have created a couple of calculated value cells, one of which requires a 3rd input, the other which just gets the days difference between the start and end date.

 

This calculated value uses the dateAddMonths inline function with the parameters StartDate (from Item Properties) and intMonthsToAdd (an integer type Form Variable I have created).

Q1. Am I using the right control?

Q2. Can I use a Calculated Value to display a calculated date as per the below format?

 

1006iA359AAE638EFA828.png

 

This (below) is the calculated value for the days difference between the start and end date.

 

The Form Variable 'intDaysDifference' shown in the formula bar below uses the following formula to calculate its value:

 

dateDiffDays(StartDate,EndDate) 

 

I've also noticed once I have saved the formula it changes appearance to this:

 

dateDiffDays({ItemProperty:u2sv},{ItemProperty:tjfd})

 

I am not sure why this does not calculate when I pick the Start Date and End Date.

 

Q3. do I need to structure this a different way to get the calculatd value to calculate straight away?

 

1007i091255FAAEC24CBB.png

 

This (below) is the single line text box I've created to input the integer type Form Variable required for "intMonthsToAdd", the calculated date value mentioned in Q1 and Q2. 

 

I know I need to get the value into the Form Variable "intMonthsToAdd" but I cannot see how it connects to the Form Variable.

 

Q4. Can someone help me to understand how this works or what I am doing wrong? 

 

1005iA668DF5005531E13.png

 

 


1 reply

Userlevel 5
Badge +14

 

 

Q1. Am I using the right control?

I guess this question relates to topic subject

why can I not connect a variable to a single line text box?

 

you need not to connect calculated value control to a variable. once you assign a name to calculated value control it appears among 'Named Controls' and you can use it in other calculations/formulas just like form variables.

 

in general, it's not allowed by design..

it doesn't make too much sense to connect form controls to form variables. at first, all the (needed) controls can be referenced as 'Named controls' and at second form variables are valid just within form session, so there is not any benefit to 'storing' anything to a form variable

 

 

Q2. Can I use a Calculated Value to display a calculated date as per the below format?

yes, this should work.

 

 

 

I've also noticed once I have saved the formula it changes appearance to this:

dateDiffDays({ItemProperty:u2sv},{ItemProperty:tjfd})

I am not sure why this does not calculate when I pick the Start Date and End Date.

if you want to calculate something out of form control values you have to reference 'Named controls' in formula(s), instead of 'Item Properties'

'Item Properties' holds list item values already saved in sharepoint. they take a list item value valid at the timepoint form loads and the value doesn't change throughout the form session. 

 

 

Q3. do I need to structure this a different way to get the calculatd value to calculate straight away?

no, that should be correct

 

 

 

I know I need to get the value into the Form Variable "intMonthsToAdd" but I cannot see how it connects to the Form Variable.

 

Q4. Can someone help me to understand how this works or what I am doing wrong? 

no, you need not to connect/store text control value into a variable. you can reference it in other formulas directly as 'Named control'

Reply