Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I am trying to omit some records that are classed as stolen or BER (Beyond Economical Repair) before I do a stocktake for my school.

Can anyone help me with this code as it is driving me crazy

Go To Layout ["Notes"]

Go To Field ["Status"]

If ["Status = "BER" or "Stolen"]

Omit Record

Go to Record/Request/Page[Exit after last, Next]

Loop

End Loop

End If

Many Thanx

Poida confused.gif

Posted

Hi Poida,

CloseTry this one.

Show All Records

Go to Layout [ Notes ]

Enter Find Mode

Set Field [ Status , "BER" ]

Omit Record

New Record/Request

Set Field [ Status , "Stolen" ]

Omit Record

Perform Find

HTH

Lee

smile.gif

Posted

Poida:

The problem with your script is that when you use an "and" or an "or", you need to restate everything, so it should read:

If(Status="BER" or Status="Stolen", etc.

Posted

Thanx all for your help

Im still not having much luck though

Ive posted the script Im using as a jpeg

The script will only omit 13 records with the value of BER or stolen

there are another 10 or 12 records which are BER or stolen which are not omitted for some reason

Its driving me crazy

Any help would be really appreciated

Posted

Sorry though I could post an image of the script for people to see

Here it is

Go To Layout [Notes]

If [status = "Stolen" or Status = "BER"

Omit Record

End If

Go To Record/Request/Page[Exit after last, Next]

Perform Script[subscripts, "Omit BER or Stolen"

Snap3.jpg

Posted

Do some records have both BER and Stolen in the same field? If so you might want to use the PatternCount function.

I think Lee's suggestion using Finds would do the job, but if you want to loop through them all...




Show All Records



Go to Record/Request [first]



Loop



 If [PatternCount(Status, "BER") > 0 or



     PatternCount(Status, "Stolen") > 0]



  Omit Record



 Else



  Go to Record/Request [Next]



 End If



 Exit Loop If [status(CurrentRecordNumber) = Status(CurrentFoundCount) or



               Status(CurrentFoundCount) = 0]



End Loop



If [status(CurrentFoundCount) > 0



 Perform Script[subscripts, "Omit BER or Stolen"]



Else



 Beep



 Show Message ["Everything was BER or Stolen.", OK]



End If



Watch the logic here: if a record is omitted there is no need to do a "go to the next record" because we're already on the next record. We need to exit the loop if we're on the last record or there are no records left in the found set. Also, the script at the end should only be run if some records weren't omitted.

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