Calc Dynamic problems
Fred
Hi Fred,
1- I have a problem in the Show_Week_Hours, the selection of Choice_Weeks is not ordered correctly.
2- Now is for one year there are possible a script for works on weeks for years.
Thanks
10 replies
-
I'll start with the 2nd question first:
Rafael said:
Now is for one year there are possible a script for works on weeks for years.One way to do it would be to add a new formula field in Cost_Week with the following code, I called mine 'YY/Week' (though I guess it should be 'YYYY/Week':
let xWeek := if WEEK < 10 then "0" + WEEK else text(WEEK) end; YEAR + "," + xWeek
To answer question 1 with the changes from above: On the Display_Choice_Week table you have to make the following changes:
1) in the Dynamic Value for Choice_Week field you need to change WEEKS to 'YY/Week'.
2) create a new formula field and put the following:
let SORTweeks := sort(for loop1 in numbers(Choice_Weeks) do record(Cost_Week,loop1).'YY/WEEK' end); let allWeeks := (select Cost_Week); let getData := for loop1 in SORTweeks do loop1 + " - " + allWeeks['YY/WEEK' = loop1].BUDGET end; join(getData, " ")
Lines 1-3: takes the choices selected in the dMC Choice_Weeks finds the appropriate record and pulls the 'YY/WEEK' data. Then sorts it in chronological order.
Line 4: gathers all of the records from Cost_Week so we can use it later.
Lines 5 - 7: takes the weeks gathered above and creates a string with the data from 'YY/WEEKS' and adds the BUDGET data
Lines 8 & 9: uses a join() function to then take the data gathered in Line 5 and creates a string that adds a carriage return after each 'YY/WEEK' record.
-
Fred
Hi Fred the Formula work great but something strange happens. I add to my main. Database.
I change the 'Cost_Week' Table for my other table 'Actual Cost & Hours' and the 'YYWEEK' is in the same table 'Actual Cost & Hours'
The error is:
Field not found I1 at line 1,column 7
Field not found I1 at line 2 column 94
But in the formula not appear the I1. And work perfect.
let x := ((select 'Actual Cost & Hours') order by YYWeek); x[var xX := this; count(x[YYWeek = xX.YYWeek]) != 2]
-
Rafael said:
But in the formula not appear the I1. And work perfect.Yes, "I1" is an internal reference for Ninox.
How can it "work perfect" and give an error?
If you got rid of line 2, does it give an error?
If you got rid of the order by does it give an error?
-
You are telling the dynamic multiple choice (dMC) field 'Choice Weeks' to look upon itself (it is in the table Actual Cost & Hours and trying to do a select of the same table.
The first DB you gave me the dMC field sits in another table, 'Display Choice Weeks'. The dMC field points to 'Cost_Week'.
-
Fred
Fix the problem Fred Thanks
Content aside
- Status Answered
- 1 yr agoLast active
- 10Replies
- 103Views
-
2
Following