C# Remove all Characters to left of ; including the ;

,

Working on a BPM on job entry to compare the input value and check inventory to see if there is enough stock. When changing the value (it was originally 100) we have a message screen that shows 100.000000;92.00 We are trying to take that value and strip it so it just says 92.00 and put it into Number01 BPM data field to use to calculate. Any help would be appreciated as this C# syntax is a nightmare

String.Format("{0:0.00}", NewValue) will do if you want to convert to string

1 Like

It looks like I will have to convert to string as what I am trying is telling me I can not do to a decimal value.

Here is what I have

image001.png

Convert decimal to string. Try with MakeToStockQty.ToString().IndexOf.(";") + 1 )

Here is what the field value says it is I put the “Make to Stock Qty” in the message

image

I am confused about what you are trying to do. You are working with decimal values and trying storing to decimal values. Decimals dont have any formatting, that is only done when displaying (mask input) or when converting to string (in which case there are specific ToString methods that will format it for you.

Ultimately, you cannot store a string value in a decimal holder.

Here is what I tried.

image001.png

I am not very good at explaining. Sorry. What I have found is when I change the value of the Make to Stock quantity in Job Entry I am able to capture the value in a BPM and show the value in a message. From what I can see there are 2 numbers there separated by a semicolon. The first value is the original and the second value is what I changed it to. If I can somehow grab the number I changed it to then I can use that to compare to our quantity on hand and determine if there is enough stock.
Hope that makes sense

Add a condition for the field has been change from any to another. That should eliminate the old value.

I am note sure whether Epicor stores like that. But try this
ttJobProdRow.MakeToStockQty.ToString().Substring(ttJobProdRow.MakeToStockQty.ToString().IndexOf(";") +1)

So I originally had the message as the first thing in the BPM which showed the 2 values. Listening to Chris_Conn about the display thing I just went ahead and put the field in by itself. Then I put the set bpm data screen first and then the message second an now magically there is only one value is showing and it is the value I changed it to.

image001.png

Split it? :slight_smile:

yourvariable.Split(';')[0]

The problem is what you are seeing, versus what is there. You are seeing those values I presume because you have added a message box and told it to show the value of that field - there are 2, most likely the before and after.

An actual record will only have a single (decimal) result in that field.

To act upon a value, you need to limit what you are targeting (presumably, you are going to want the changed or added value. (Along the lines of what @gpayne mentions)

Okay makes sense now but did not realize. I have moved along with this BPM and now am needing some help. Not sure if this is another ticket or continuation of this one. I am using a Set Argument/Variable widget and need an expression that returns the OnHand Quantity of the Part Warehouse table. In this widget I have a temp table called ttJobMtl I somehow need to link it to the PartWarehouse table by company by part and get the onhand quantity. Any help is appreciated.

image001.png

Thanks for the help. This ticket can be closed.

You are welcome, awesome closed it. Let us know if you need anymore help.