Extracting Part Of String From Database Field Based On Certain Character
Hi,
i have a bartender label that is linked to a txt based file. I want to extract a certain value from a database-field.
Field looks something like this:
'some text i do not need # part i need'
I want to extract 'part i need' from the string (also trim the space on the left).
I tried VBscript but i can not get it to work. Using BT 10.1 SR3
0
-
Maybe try something like this (assumes that there will only ever be one occurrence of # followed by a space in the field's content):
str = Format.NamedSubStrings("NameOfDataSourceContainingTheDBFieldContent").Value splitat = "# " str_segments = Split(str, splitat) Value = str_segments(1)0 -
used the OnProcessData option.
pos = 0 pos = Instr(Value, "#") +1 if pos > 1 then value = Trim(Mid(value,pos)) elseif pos = 1 then value = "" End If
works just fine
Example:
'this part we don't need # just this part'
will translate to:
'just this part'
Note: when no # is in the line we will print nothing.0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
2 Kommentare