Jump to content
Sign in to follow this  
Daniel Shanahan

Multiples of a particular number

Recommended Posts

Is it possible to select records based on multiples of a particular number? I want to use this in a Case statement. I currently have

Case (Subject_ID = 3 or 8 or 13 or 23 or 28; "Mathematics")

This works fine. I am just wondering if I can shorten it a bit. What I'd like to do is say "Find every multiple of 5 beginning at 3 and ending at 28." Also, would such a function work with an "or" statement? I want "Mathematics" to appear only if one of the multiples of is true.

Thanks.

dan

Share this post


Link to post
Share on other sites

I currently have

Case (Subject_ID = 3 or 8 or 13 or 23 or 28; "Mathematics")

This works fine.

I doubt it. This would ALWAYS return "Mathematics".

"Find every multiple of 5 beginning at 3 and ending at 28."

You could try:

Case ( not Mod ( Subject_ID - 3 ; 5 ) ; "Mathematics" )

Or, if the 'ending at 28' condition is significant:

Case ( not Mod ( Subject_ID - 3 ; 5 ) and Subject_ID < 29 ; "Mathematics" )

I want "Mathematics" to appear only if one of the multiples of is true.

I didn't get this part.

Share this post


Link to post
Share on other sites

Mod() can find multiples of 5:

Case( Subject_ID >= 3 and Subject_ID <= 28 and Mod(Subject_ID-3, 5) = 0; "Mathematics" )

I'm not sure what you mean by "one" of the multiples, is Subject_ID a multi-key value?

I see my post is an exact duplicate.... :)

Edited by Guest

Share this post


Link to post
Share on other sites

Thanks for the responses. I was trying to create a "work-around." I have a series of hierarchical portals and I was trying to "dump" information into a field and then have that field accessible via a portal on another page. See the attached file.

Also, see my related post Topic#188726.

Thanks.

dan

TeacherDB.fp7.zip

Share this post


Link to post
Share on other sites

Can anyone shed some light on why the portal fields "bounce" back to the first portal record?

- dan.

Share this post


Link to post
Share on other sites

I took a look at your file. Unfortunately, portals are not quite that flexible.

If I have a chain of relationships, with A being the table the layout is based on:

   A - B - C - D - E - F

You can create a portal for table D to put on this layout, and it will show all related records from D. You can also drop fields from B and C into the portal, and they will be the correctly corresponding values for each D record.

But, putting a field from E or F into the portal will only show the first value (for the D record you're looking at). This is similar to how dropping a field for D on the A layout will only show the first value.

Basically, a portal based on table D will have one row for each related record in D, you'll never get any more than that.

Hope this helps.

Share this post


Link to post
Share on other sites

Thanks Shadow. It helps to know that I could not make this work because it was not intended to work that way (hope that makes sense).

Thanks for the reply.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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