I am pulling in a numerical field from an XML table which could include 1 or up to 20 products. The "QuantityOrdered" field includes a dash (Ex: 6-)after every number I would like to remove. I have tried to remove using substring subtract function although the final render removes more than 1 character resulting in no data.

set @OrderDetails = BuildRowsetFromXml(@xmldata,"//OrderDetails/OrderDetail",1)
set @OrderDetailsRows = RowCount(@OrderDetails)

for @p = 1 TO @OrderDetailsRows do
 set @row = Row(@OrderDetails, @p)

 IF NOT EMPTY(Field(Row(@OrderDetails,@p),'QuantityOrdered_att'))
 SET @QuantityOrd = substring(@QuantityOrd,1,subtract(indexOf(@QuantityOrd," "),1))

  • If @QuantityOrd is expected to be whole numbers, removing the dashes via replacement (e.g., set @QuantityOrd = replace(@QuantityOrd, "-", "")) could be a simpler approach.
    – Mark G
    Commented May 24, 2020 at 8:12

1 Answer 1


@MarkG - Thanks Mark - That worked. I recalled the attribute and added to function Set @Quan1 = Field(Row(@OrderDetails,@p),'QuantityOrdered_att')) IF NOT EMPTY(Field(Row(@OrderDetails,@p),'QuantityOrdered_att')) THEN Set @QuantityOrd = replace(@Quan1, "-", "")) Much appreciated!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .