Jump to content
The ORIGINAL FileMaker Community - Forum - Online Business Apps & Software Forum
Hyperscripter

Problem with Let Function

Recommended Posts

Hyperscripter

When I try to compile this, I get the error 'If LeftWords' function was not found.

 

Let ([

theMonth = MonthName (Get(CurrentDate));

theYear = Year (Get(CurrentDate));

theMonthYear = GetAsText("April " & theYear)];

 

If LeftWords (Calendar::calendar4a ; 2) = theMonthYear ; TextSize ( Calendar::calendar4a ; 24 ) ; TextSize (Calendar::calendar4a ; 9 ))

 

I have used the Let function before, but this one really stumps me. No matter what I try, I get one error or another. Anyone have any ideas ? I imagine it's something simple, but I just can't figure it out.

Share this post


Link to post
Share on other sites
eos

This has nothing to do with Let(), but with

If LeftWords
, which is not valid syntax; If() is one function, LeftWords() another: If ( LeftWords ( … ) )

 

btw, 1. why declare theMonth, then not use it? 2. why not use Let() consequently, e.g.

 

Let ( [
 cd = Get ( CurrentDate ) ;
 theMonthYear = MonthName ( cd ) & " " & Year ( cd ) ;
 calEntry = Calendar::calendar4a ;
 theTextSize = Case ( LeftWords (calEntry ; 2) = theMonthYear ; 24 ; 9 )
 ] ;
 TextSize ( calEntry ; theTextSize ) 
)

 

Consider using Conditional Formatting to change display size, instead of cluttering the schema.

Share this post


Link to post
Share on other sites
Hyperscripter

I may not have explained clearly what I wanted to do. I have a db with calendars January through December. I wanted conditional formatting to be applied only to the the calendar which contains the current month and year in its header. Once I have that figured out, I want to set things up for the other calendars in a similar fashion.

 

In other words, next month the same formatting would be applied to the calendar for May 2015 etc.

Share this post


Link to post
Share on other sites
eos

Then your calculation isn't correct anyway; a CF calculation is not supposed to return a format, but (as explained in the dialog box) a Boolean value that determines if its formatting is to be applied.

 

So you'd format your layout object with 9pt, then add a CF condition with result 24pt size and the calculation

 

Month ( self ) = Month ( Get ( CurrentDate ) ) and Year ( self ) = Year ( Get ( CurrentDate ) )

Share this post


Link to post
Share on other sites
Clemencello

Bracket required immediately after if

Share this post


Link to post
Share on other sites
Hyperscripter

Got it. Obviously using Self is the best approach for this.

 

Thanks

Share this post


Link to post
Share on other sites
eos
Obviously using Self is the best approach for this

 

Not exactly the point I wanted to bring across :D, which (probably) is: use a calc that returns the desired result type (Boolean, in this case).

 

If you wanted to CF a different field, you couldn't use Self, but would have to reference the date field explicitly.

Share this post


Link to post
Share on other sites
This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...

Important Information

Terms of Use