Jump to content
Server Maintenance This Week. ×

Script loop through fields


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

Recommended Posts

I have 20 fields I need to check and perform a funtion I would like to do it with 1 simple script like this

Set Field [ mathsheet::countfield; "1" ]

If [ "mathsheet::dn"&mathsheet::countfield="yes" ]

If [ "mathsheet::depth"&mathsheet::countfield=26.5 ]

Set Field [ mathsheet::dndepth26; mathsheet::dndepth26+"mathsheet::len"&mathsheet::countfield ]

Commit Records/Requests

[ Skip data entry validation; No dialog ]

End If

End If

then look adding one to the countfield... so if.

dn1 = "yes" then do something in a field ending with the "1", then

dn2 ="yes" then do something in a field ending with the "2" then

dn3="yes" then do something. etc...

the script itself does not generate an error but obviously does not work the way it is, I also need it be be able to work in IWP... any ideas would be great...

thanks in advance..

PS. a screen shot is attached

scrn.jpg

Link to comment
Share on other sites

Can you explain what this is about? It's quite obvious your real problem lies with the structure, not with the script. You should be using records in a related table or repeating fields for the 20 items.

I can not use a related table because the 20 fields must be on the same record as they are doing a nesting routing to calulcate the best LFT yield of material. I suppose I could use repeating fields but it may become more complex later in the program. I was hoping to keep it simple so anyone could open it up and make changes in the event I am unavailabe to make changes down the road. But I will try repeating fields and see if it works..

Link to comment
Share on other sites

I can not use a related table because the 20 fields must be on the same record as they are doing a nesting routing to calulcate the best LFT yield of material.

False conclusion.

There is a difference between "I do not know how" and "cannot".

Link to comment
Share on other sites

I am afraid I have no idea what that means.

That's exactly my point.

OK,You are correct, perhaps I am missing something . I WOULD LOVE TO MAKE IT SIMPLER.

what you dont see behind the scenes is the nesting, it takes every possible combination in sets of 4's and check it against material length max of 144.49"

so I have a bunch of calculation fields as an example see attached picture..

basically looking at 4 boxes at a time, calcluation how much material I need, if over 12 ft, the it does it in 2 ft increments

so if the dimensions in the 1st 3 fields 96" then 36" then 12.5".. it calculates that I can get the 96 and 36 from a 12ft board and that I need another 2ft board for the 12.5 inch piece a total of 14 ft of board is needed.

lft.jpg

Link to comment
Share on other sites

I am missing the beginning of the story. "every possible combination" of what? What is being given here and what do you need to arrive at?

Sorry, I need to cut boards to specific lengths given by a customer, I buy material in 12 foot lengths, so to get the best yield from the material I can enter up to 20 lengths from the customer and it will tell me how many feet I need to use to get the best yield... that aside, I want to process each lines dimension and make sure it fits the depth of materail. the material I buy is 30" wide.. if the piece the client needs is 48" long by 36" wide, I need to special order a piece that wide, also on special order I have to buy 8 feet at time.. so he will have to pay for an 8 foot minumin. So I need to move that dimension out of my list of 20 and move it to its own catagory and bill its feet differently...

so in order for the computer to know the depth is different I am using scripts to read each line, but instead of having 20 scripts I want to try and do it in one script that...

Attached is a screenshot of the script to process line 1 I was just hoping to not have to create the script 20 times..

script1.jpg

Link to comment
Share on other sites

This seems like a very difficult problem and I am not sure how you propose to handle it, mathematically speaking (I don't understand what your script is trying to do). If you can explain how your process would be implemented by hand, I can help you "translate" it to Filemaker.

---- EDIT ----

I have taken another look at this and I think I finally understood what you're trying to do (I hope).

SummarizeMaterial.zip

Edited by comment
Link to comment
Share on other sites

This seems like a very difficult problem and I am not sure how you propose to handle it, mathematically speaking (I don't understand what your script is trying to do). If you can explain how your process would be implemented by hand, I can help you "translate" it to Filemaker.

---- EDIT ----

I have taken another look at this and I think I finally understood what you're trying to do (I hope).

Wow, simple , elegant... I never thought of using case.. I can definatly adapt that to my app, and to a couple other databases I have... thanks so much...

Link to comment
Share on other sites

This topic is 4808 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.