vendredi 26 janvier 2018

Crystal IF Next in fomula

I have learned Crystal by trial and error, so please forgive my phrasing.

I want to combine text and fields. If there is more than one instance of Tensile.SOItemNum, then I want to repeat all instances of that field within my resultant text string and have the multiple instances be separated by commas. (Actually I would want this section to repeat for each record of Tensile.SOITEM.

The following is the formula for one text string and this would work if there were just one record.

Formula = "0003015339|01|" & totext({Tensile.SONum},0,"") & "-" & totext({Tensile.SOItemNum},0,"") & "-" & {Tensile.Lot} & "|" & {SOItem.CustPO} & "|" & totext({SOItem.SOItemNum},0,"") & "|" & {SOItem.ProdCode} & "|" & totext({ManifestLotView.Manifest},0,"") & "-" & totext({ManifestLotView.SONum},0,"") & "-" & totext({ManifestLotView.SOItemNum},0,"")

Which produces:

0003015339|01|114667-10-1-B-1|5400361554-R01|10|XALRET05012|27202-114667-10

If there were a 114667-10-1-B-1 and a 114668-5-2-B-1, I would want the string resultant string to read:

0003015339|01|114667-10-1-B-1,114668-5-2-B-1|5400361554-R01|10|XALRET05012|27202-114667-10

This is some of what I was trying, but it is not a valid formula. I have not used the Next function before.

Formula = "0003015339|01|" & totext({Tensile.SONum},0,"") & "-" & totext({Tensile.SOItemNum},0,"") & "-" & {Tensile.Lot} & IF nextvalue ({Tensile.SONum}) > 1 then "," & totext({Tensile.SONum},0,"") & "-" & totext({Tensile.SOItemNum},0,"") & "-" & {Tensile.Lot} end if "|" & {SOItem.CustPO} & "|" & totext({SOItem.SOItemNum},0,"") & "|" & {SOItem.ProdCode} & "|" & totext({ManifestLotView.Manifest},0,"") & "-" & totext({ManifestLotView.SONum},0,"") & "-" & totext({ManifestLotView.SOItemNum},0,"")

Thank you in advance for your time.

Aucun commentaire:

Enregistrer un commentaire