Temporary codes and B codes | XM Community
Skip to main content

Temporary codes and B codes

  • June 1, 2023
  • 6 replies
  • 44 views

Forum|alt.badge.img+7

For one of my projects, we use the embedded temporary codes, assigned randomly to participants. This has generated duplication. Is there a way of creating a system of B codes instead, where these are given to participants in 7’s? For instance, B00000001, B00000008, B00000015, B00000022, B00000029 etc. If so, how would this be set up and how can I make that the system knows what code has been issued before generating the new one, to make sure the codes are generated in 7’s?
 

6 replies

ArunDubey
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+41
  • QPN Level 8 ●●●●●●●●
  • 589 replies
  • June 1, 2023

You can use JS and generate unique number with the combination of random number, current date and and respondent number. You will definitely get unique number using these three combination. Refer below link and try to use it and play with combinations.

 

https://stackoverflow.com/questions/26203453/jquery-generate-unique-ids


Forum|alt.badge.img+7

Thank you for your reply. I think I need to clarify my point a little more. We already have a way of generating random codes that are presented to participants and are stored as embedded data. However, this random generation has the possibility of producing duplicates. We are, therefore, looking to have a system in which we know exactly which codes are going to be generated. This will prevent duplicates in the future. 

Would it be possible to add in a mathematical equation to the code so that it is generated in a sequence (i.e. increments in 7’s), whilst also keeping the same code format (B followed by 8 digits = 9 character code)? Plus, is it possible for the system to know what code was generated before so that the correct number in the sequence can be given? Keeping the format of the code is the important bit.

I apologise if my choice of words is not too clear, I am not too familiar with the technicalities of coding.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6083 replies
  • June 2, 2023

@Super_Recognisers.

You could use a webservice and external database to assign and keep track of used codes.


ArunDubey
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+41
  • QPN Level 8 ●●●●●●●●
  • 589 replies
  • June 2, 2023

@Super_Recognisers.

You could use a webservice and external database to assign and keep track of used codes.

Good solution @TomG , I was about to share the same. They can create a counter respective to each generated code and can use unused code from external DB.


Forum|alt.badge.img+7
  • Author
  • Level 2 ●●
  • 30 replies
  • June 27, 2023

Thank you @TomG and @ArunDubey for your suggestions. What do you mean by external database?


ArunDubey
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+41
  • QPN Level 8 ●●●●●●●●
  • 589 replies
  • June 27, 2023

External database means, mysql, ms access etc to save the data in tables.