Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4807 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Specific problem (columnar reporting and script deciding how many columns)

I am figuring months and if another field says "comparative" then I want to double the number of months. I found calc to use can not figure it.

12 * ( Year ( end ) - Year ( start ) ) + Month ( end ) - Month ( start ) + 1 + ( ADMIN::gReportStyle = "Comparative" ) * 2

If dates are 4/1/2011 - 8/31/2011, it produces 5 like it should if style is "Contiguous" but produces 7 and it should produce 10 if "Comparative". I am being stubborn and do not want to switch to using Case. I know the order is wrong but I tried 20 combinations and still can not see it.

btw the calc did not have the part in bold lol when I first found it

Posted

How about =

Let (

months = 12 * ( Year ( End ) - Year ( Start ) ) + Month ( End ) - Month ( Start )

;

months * Case ( ADMIN::gReportStyle = "Comparative" ; 2 ; 1 )

)


 

or, if you prefer =

 


Let (

months = 12 * ( Year ( End ) - Year ( Start ) ) + Month ( End ) - Month ( Start )

;

months * ( 1 + ( ADMIN::gReportStyle = "Comparative"  ) )

)

Posted

Hello Comment, it is always a pleasure

I was hoping for a quick one-liner using that theory of * boolean and you gave me the missing parts to understand it. Your calcs do not produce inclusive numbers but that should be IS small change. Your calcs show what is happening and helped me understand what was wrong in my attempts. Here is what I came up with after studying yours

( 12 * ( Year ( end ) - Year ( start ) ) + Month ( end ) - Month ( start ) + 1 ) * ( 1 + ( ADMIN~Main Menu::gReportStyle = "Comparative" ) )

but. It is not as easy to understand as yours and if I saw it later, odds are I will have forgotten why I wrapped the whole thing with brackets so it would apply the times'd amount against it all. I learned to understand this by your clear calculations. And I learned that one-liners are not always the best.

I will use your second calculation and I thank you again for helping me.

Why does my code not look like yours? I do not like the way mine displays the scroll nor how it goes off the page. Do you do something special to make yours looks so good? Never mind, it is because it is too long. I changed it.

Posted

Yet another option =

Let (

months = 12 * ( Year ( End ) - Year ( Start ) ) + Month ( End ) - Month ( Start )

;

months + ( ADMIN::gReportStyle = "Comparative" ) * months

)

Posted

months + ( ADMIN::gReportStyle = "Comparative" ) * months

Is this "months plus either 0 or 1 * months" so

Comparative is : months + 0 * months and 0 * anything is zero so only months is result

not Comparative: months + 1 * months and 1 * months is doubling months

? Wow. This is best one of all; not one-liner (good) but crisper than your other two. I am changing it as we speak.

I was wondering about those brackets not necessarily here but many times in calcs but here too. Is Case() the same as ()? they both seem to ask questions but one is saying 'look for answers under this configuration (result options)', such as Case() and If() and the other, brackets alone, seem to say 'look for answers but only as boolean.'

I am not always clear on their purpose but I can replicate concepts so I kinda know how they go but not always why. And I think I have figured out that they must always balance so sometimes I count them when confused.

ps I thought boolean was a condition result state 0 or 1 and not a noun. Why does this site say I misspell it? And yes I confess to misspelling 'calc' just because I like to. :D

UPDATE. I think yes to my first question and this is wonderful concept.

Posted

I realize not all brackets are questions, such as Let() but I hope you understood my using them in this context. Also, I notice you kept dropping off the extra column to make it inclusive. Is this because it would be more usable to all visitors of the forum or were you seeing something I did not understand? If start in April and ends in April I must add 1 or I would never get that column. Maybe I am just trying to add it in the wrong place. The extra column should not be added if Comparative but all others should add it.

To clarify there was more to the calc but I did not want to bother anyone. Comparative doubles the columns as Apr 2010 Apr 2011 May 2010 May 2011. Years will not allow Comparative because years columns will BE as comparative as you can get.

I can use your calc on months to replicate the rest. I was just trying to understand where to add those extra columns. My apology if it was confusing. I probably should have slept in today.

Posted

I am still not sure what's your objection to Case().

Re my dropping the + 1, it's merely lack of attention to non-essentials: after all it could have been =

Let (

n = <anything>

;

n + ( a = b ) * n

)

or at least that's how the original question put it?

---

"Boolean" is both a noun and an adjective. It is spelled with a capital B, after George Boole.

This topic is 4807 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.