Help with Formula

4 posts / 0 new
Last post
profit814
Offline
Joined: 03/18/2018 - 17:12
Help with Formula

I need some assistaance with creating a script. Im trying to take the formula  below and replace it with variables based off an input box. i can get the code to run seperately but when i add the "or" it throws it off. Any help would be appreciated.
task.AddExtraction dbName, "", " CREDIT  >=  ( 1000000 )  .OR.  DEBIT  >=  ( 1000000)"
i have the following but am getting errors
task.AddExtraction dbName, "",   debit & " >= " & amount &  .or.    credit & " >= " & amount

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi and welcome to the site.  The .OR. and field names are part of the equation so you have to leave them within the quotes.  The only thing that should be outside of the quotes is the variables.  So assuming that the debit and credit are the fieldnames and not variable your equation should probably look like this:

task.AddExtraction dbName, "", " CREDIT  >=  " & amount & "  .OR.  DEBIT  >= " & amount

Let me know if you have any problems, good luck with your project.

Brian

 

profit814
Offline
Joined: 03/18/2018 - 17:12

Thanks for the comment and quick response Brian, if i want both credit and debit to be variables as well, how would i modify the line.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

If they are both variables then the line would look something like this:

task.AddExtraction dbName, "", creditVar & " >=  " & amount & "  .OR.  " & debitVar & "  >= " & amount