Jump to content

Calculation help request


pryjda
 Share

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

Recommended Posts

I would like to thank everyone who has helped me since my joining this forum.

I must say this is the best one I subscribe too. I hope that someday, I can do the same for you as well.

I am having trouble with a calculation and I could really use a little advice.

I am using a calculation to combine multiple fields (all from the same table) into a longer text field. Along the way, with my calculation, I am adding HTML tags to help me later when I export the field contents. Any way. I have come to a point where one of my fields is not always populated. This field is called "description_features" and it is the last field in set of 5 fields.

Now what I would like to do is first check to see if the field is populated. If it is not, my calculation would finish. No problem. But, if the field is populated, add a Heading” "FEATURES

" & "¶" and then the contents of that field.

Can anyone help advise me? I can either show or remove “FEATURES” on every single record but that makes my data stream look messy and unprofessional. If my item does not have any features, why would I say there was?

Thank you all viewing this post.

And thank you all in advance for your help.

James

Link to comment
Share on other sites

Martha, you rock!

Thank you so much for your guidance. your If statement pointed me in the right direction.

Please feel free to use my code if you think you can find a use for it.

"

" & description_headline & "

" & "¶" &

"

" & description_subhead & "

" & "¶" &

"

" & description_internet & "

" &

If(IsEmpty(description_features); ""; "

F E A T U R E S

" & "¶" & "

" & description_features & "
")

Thank you eveyone for viewing this post.

nice shades Martha

Link to comment
Share on other sites

Whenever I see something like:

If( IsEmpty(Field); ""; "result")

It seems cleaner to me to do this:

Case( not IsEmpty(Field); "result")

It's just one less predicate to worry about.

If I may also comment on your HTML, using font color and bold tags is so 20th century -- your code will be much cleaner and easier to maintain if you use CSS.

Link to comment
Share on other sites

Hi Tom,

thanks for the advice on the Case statement.

I agree about he CCS, I am still in the testing phase of my application and I plan to incorporate it as soon as as I work all my current bugs out. in fact I already have one made for the rest of my web site. Master.ccs

Do you know how to include the CCS into my calculation, or would it be better to include it in my export script? I assume you have experience with this and any advice you might have would be super valuable.

Thank you so much for your help.

I appreciate an expert on my side.

James

Link to comment
Share on other sites

It seems cleaner to me to do this:

Case( not IsEmpty(Field); "result")

If the field type is text, is there an extra simplification:

Case(Length(Field);"result")

...should work though with all types except containerfield - due to a typecast!

--sd

Link to comment
Share on other sites

I know Filemaker wrote it that way, but most of the time a single space is functionally equivalent to being empty, in which case IsEmpty will return the wrong result. I've seen users go into a field, back out but inadvertently leave a space. Length or WordCount, when the field is small, shouldn't make much of a speed difference.

Steve

Link to comment
Share on other sites

FileMaker almost always has several or more ways to accomplish the same task. When I am deciding which ways to approach a task, I almost always consider speed of execution since it can play a big part in whether I use a technique or not. Speed testing interests me so much that I even presented at the 1999 Developer Conference on the subject. So I decided to test the speed difference between the Length and IsEmpty functions. Since you can't usually see a speed difference when computing a single record, I like to test the speed difference of functions using a looping script. I created four scenarios:

1) Length of a field with 283,000 characters in it

2) not IsEmpty of a field with 283,000 characters in it

3) Length of a field with 4 characters in it

4) not IsEmpty of a field with 4 characters in it

With a lot of characters in the field, Length took significantly more time (almost twice as long) when looping through several hundred records. However, when testing on just 4 characters per field, the speed difference was negligible. Sometimes IsEmpty was faster and sometimes Length was faster. Differences in speed arise simply because FileMaker doesn't have accurate enough time fields.

On the other hand, if you are using the calculation as a Define Database field, the speed difference will be negligible between IsEmpty and Length since you are only computing a single record. But, why use a function other than IsEmpty since it was designed specifically for this task. And, even though the speed difference might be negligible on a single record, you have to consider there might be more than one calculation. I almost always use the speediest function whenever possible to make my solutions perform as quickly as possible. For example, the Left function is faster than LeftWords. If Left can do the job just as well as LeftWords then use it.

Anyhow, just my thoughts.

Link to comment
Share on other sites

Thanks for doing that testing, John.

Back to the OP's question: the beauty of CSS is that you don't have to do anything to your export!

Well, there is one thing: you need a link to your CSS file in the head of your html page.

Use one of these two formats:

@import "example.css";

The "example.css" above is just a text file in which you define, or more to the point re-define your page elements. Here we change the look of our paragraph and H2 tags:

p {

font-family: "Verdana", serif;

}

h2 {

font-size: 110%;

color: red;

font-weight: bold;

}

Are you starting to see the beauty of this? Your HTML can stay nice and tidy, and simply by changing your CSS file you can change the look of your entire website without even touching a single page!

To me, designing a website without CSS is like designing a database with FileMaker 2.0. You're missing out on a lot of power! CSS is really the standard today; all professional web designers use it and all modern browsers support it. I've only scratched the surface here; you can also use CSS for positioning (no more tables) button-highlighting (no more javascript) and more.

Just google "css" and you'll find a zillion links in addition to the one in my last post.

Wikipedia

HTML Tutorials

Fear of style sheets (A List Apart)

Creating your first style sheet

Link to comment
Share on other sites

This topic is 5658 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
 Share

×
×
  • Create New...

Important Information

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