lundi 24 mars 2014

VBScript to combine rs values, loop and add to duplicate(s)


Vote count:

0




I've written a lot of IF statements in VBScript, but haven't gone much beyond that so apologize for my lack of experience. I hope what I'm asking is simple to do.


I want to output item identifiers created by three combined recordset field values and add "B" "C" "D" etc., to any duplicates. Duplicates are rare, but do happen occasionally. I want to do this for meaningful item identification which autonumbers do not provide.


The following example works to combine fields, but then I need to include script to loop and find the duplicates and add the appropriate alpha character.


FYI: a = alpha character, b = alpha character, c = reformatted date



<% Dim idCode
a = (rs_table.Fields.Item("CodeA").Value)
b = (rs_table.Fields.Item("CodeB").Value)
c = (fixedDate(rs_table.Fields.Item("Date").Value))
idCode = (a) & (b) & (c)
Response.write idCode
%>


example output: LC032414 example dupe output: LC032414B


Thanks, I'm almost afraid to ask and may find this more pain than what it's worth!



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire