CREATE ... FOR EACH & Incremental Numbers

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

CREATE ... FOR EACH & Incremental Numbers

Post by PointsWell »

There's probably a really obvious way to do this.

I am creating an Object BerthTypes. BerthTypes has a maximum value. I want to create an Object Berth for however many is specified in BerthTypes.Maximum.

That is straightforward
CREATE Berth FOR EACH NUMBER BETWEEN 1 AND BerthTypes.Maximum

However I want to populate a field with a descriptor and a number as a default eg. MOORING 1, MOORING 2, MOORING 3 ... MOORING [BerthTypes.Maximum]

Is there a straightforward way to do this? The counter is independent of everything else in the system so SystemSettings is not use and CREATE ... FOR EACH won't update the LIRU
customaware
Posts: 2399
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: CREATE ... FOR EACH & Incremental Numbers

Post by customaware »

Try,

CREATE Berth FOR EACH NUMBER BETWEEN 1 AND BerthTypes.Maximum WITH Berth.Mooring='MOORING '+LOOP_ITERATION
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: CREATE ... FOR EACH & Incremental Numbers

Post by PointsWell »

eagles9999 wrote:Try,

CREATE Berth FOR EACH NUMBER BETWEEN 1 AND BerthTypes.Maximum WITH Berth.Mooring='MOORING '+LOOP_ITERATION
That is much more elegant that what I did.

Thank you!
BenHayat
Posts: 2749
Joined: Thu Dec 23, 2010 5:48 am
Location: Fla, USA
Contact:

Re: CREATE ... FOR EACH & Incremental Numbers

Post by BenHayat »

PointsWell wrote: That is much more elegant that what I did.

Thank you!
That means you will be going to his conference...
Post Reply