Forum Academy Marketplace Showcase Pricing Features

Generating ticket numbers

I’m trying to generate a number like this for say, a flight number.

I want daily flight numbers to be something like this:

date of flight + (append, not add) 1 (2, 3, 4, 5 etc) eg: 130820211, 130820212, 120820213 etc

In order to do this, I need to search for that date’s flights, get the flight number, but strip away the date part to be left with the last number to add to. Is there a way to do that? I’ve been messing with it for ages but can’t figure it out within the confines of the expression field.

Depending on the format of the incoming string you could use split by I think.
https://manual.bubble.io/core-resources/data/operations-and-comparisons#split-by

push comes to shove you could use “extract with regex” but regex can be a little involved if you’re not already familiar with it.

Hey @tonymoulatsiotis :wave:

I think, if I were you, I would simplify the process. Since you are creating the number yourself, just save the number as two separate fields. One with the full number put together, and the other field as the unique number separate from the number.

For example:

Flight number: 130820211
End Number: 11

Then you can just reference that end number without doing a truncate or regex or anything complicated like that.

Sometimes we make things more difficult than they have to be. Keep it simple if you can.

There are a bunch of ways to do this, this was just one suggestion.

Hope that helps! :blush:

@j805 www.NoCodeMinute.com

For All Your No-Code Education Needs:

1 Like

Hmm, I don’t know what that means.

I may have got around it by doing the following, though I doubt this if very efficient.

Flight has multiple fields, but of note:

Flight Date
Number
Flight Number

Flight Date (date)= takes date from the booking hours and minutes changed to 0
Number (number)= Do a search for flights where Flight Date = booking date hours and minutes changed to 0 sorted by Number, descending :first item + 1 (or basically find the latest flight number on this date then add 1)
Flight Number (TEXT field) = Flight Date formatted as ddmmyyyy :append Number

I ended up with 130820211 like I wanted, though this isn’t really how I’d like to do this…seems very intensive. Since the Flight Number depends on the Number and Flight Date it has to be a second workflow which is annoying. I wish there was a way to do that all in one workflow as there have been a few cases where I have a piece of data that is reliant upon data that hasn’t been created yet but i’d like it to be all in one workflow.