I want to use an external rule to add iProps & then use any field data already present to calculate cost.
The adding of the iProps is (for the most), sorted. What I need to do next is:
So I want "Unit_Buy". This will be the result of "Unit_Trade" with "Discount" applied.
Here's what I have so far for the conversion of "Unit_Trade":
Dim Unit_Trade As String = iPropGetStr("Unit_Trade", "0") Dim Unit_Trade_NUM As Integer = iPropGetStr("Unit_Trade_NUM", (Int32.TryParse(Unit_Trade, Unit_Trade_NUM))) Dim Discount As String = iPropGetStr("Discount", "0") Dim Discount_NUM As Integer = iPropGetStr("Discount_NUM",Int32.TryParse("Discount", Discount_NUM))
During the development of the iLogic, I've added an iProp from "Unit_Trade_NUM" so I can see if it works. It doesn't. The iProp is added with the format YES/NO.
The workflow at present is:
Before each time for step 1 above, I make sure any existing iProp with the format Y/N is deleted, so the rule will add it.
I'm not sue if I've got the syntax for the TryParse correct, or have I have missed something else entirely?
Solved! Go to Solution.
Solved by clutsa. Go to Solution.
So this seems to work for me even though it doesn't seem like it should.
Dim Unit_Trade As String = iProperties.Value("Custom", "Unit_Trade") Dim Discount As String = iProperties.Value("Custom", "Discount") Dim Unit_Buy As Double = Unit_Trade * Discount iProperties.Value("Custom", "Unit_Buy") = Unit_Buy MessageBox.Show(iProperties.Value("Custom", "Unit_Buy"), "Title")
This does a bit more to help get your text to a number format if you don't have only numbers as the text.
Dim Unit_Trade As String = iProperties.Value("Custom", "Unit_Trade") 'MessageBox.Show("Unit_Trade = " & Unit_Trade, "Title") Dim Unit_Trade_Num As Double = Val(Replace(Unit_Trade,"$","")) 'Val returned '0' if preceded by '$' 'MessageBox.Show("Unit_Trade_Num = " & Unit_Trade_Num, "Title") Dim Discount As String = iProperties.Value("Custom", "Discount") 'discount is enter as '20%' Dim Discount_Num As Double = Val(Discount) / 100 'val returns '20' not '.20' as we need for a percent Dim Unit_Buy As Double = Unit_Trade_Num * Discount_Num iProperties.Value("Custom", "Unit_Buy") = Unit_Buy 'MessageBox.Show("Unit_Buy = " & iProperties.Value("Custom", "Unit_Buy"), "Title")
There is also "CDblAny(myString)" you can try if "Val(myString)" isn't working for you.
If value of custom iProperty is either "True" or "False", delete the existing custom iProperty. For deleting custom iProperty, refer the answered post in below forum discussion link.
Thanks and regards,
Thanks for the replies. Apologies for the late reply, but work stuff etc.
In the end, I re-structured the whole thing & then most recently, have engaged someone to assist with the wider customising tasks.
The Boolean issue was because I was using an incorrect function.
Thanks again.
Can't find what you're looking for? Ask the community or share your knowledge.