0

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'))
 THEN 
 SET @QuantityOrd = substring(@QuantityOrd,1,subtract(indexOf(@QuantityOrd," "),1))

ENDIF 
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 May 24 '20 at 8:12
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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.