Morph field with data from another field

I have imported a bank statement as a csv file. The value in the amount field is both positive and negative , for credits and debits. I want to put the positive in a field named Credits, and the negative in a field named Debits. Is there a way to separate the amounts field and fill two new fields in this fashion?

Thanks

In a procedure you would write

Field Credits
FormulaFill ?(Amounts > 0, Amounts, zeroblank(0))
Field Debits
FormulaFill ?(Amounts < 0, Amounts, zeroblank(0))

Using the Morph dialog you would “Start with Formula” and use the formulas from the FormulaFill commands above

?(Amounts > 0, Amounts, zeroblank(0))

?(Amounts < 0, Amounts, zeroblank(0))

Dave’s suggestion is perfect, and is probably the way to do it. But just for fun, I’m going to suggest a couple of other possibilities. These aren’t better (or worse) than Dave’s code, just different.

field Credits
select Amounts > 0
formulafill Amounts
field Debits
select Amounts < 0
formulafill Amounts
selectall

Here is another method:

field Credits
formulafill zeroblank(max(0,Amounts))
field Debits
formulafill zeroblank(min(0,Amounts))

Thanks for these examples. Helps me become more facile manipulating data in fields

Using this procedure for a profit/loss statement.

select «Date» => date(“12/31/2024”) and «Date» < date(“01/01/2026”)

field Purpose

groupup

field DEBIT

total

field CREDIT

total

How can I express CREDIT total- DEBIT total =

and have the resulting value displayed in my report form?

The CREDIT total and DEBIT total show up in the form but I can’t figure out how to use those values in a formula and display that number in the form.

You can use the aggregate( function to get the sum of CREDIT and DEBIT values, which you can use in a formula. That can be more useful than grouping.