Hi Guys,

this might be a easy one but somehow I did not get the trigger... 

I am using a mobile app to scan barcodes to a list. The user shall know the amount of scanned barcodes. therefore I use CurrentRowNumber in a "Numbers Badge". But this starts with row 0. Is there a possibility to start counting with row 1? Actually it is row 1...

Thanks! 

Tobias

By design, the first row number is always 0. What you can do is to display CurrentRowNumber + 1. ;)

Hi Joao,

thanks for replying on the weekend!

Using CurrentRowNo + 1 makes it 01, 11, 21, etc...

Best regs

Tobias 

BigSlikTobi wrote:

Hi Joao,

thanks for replying on the weekend!

Using CurrentRowNo + 1 makes it 01, 11, 21, etc...

Best regs

Tobias 

It should work as João wrote. Can you show how you did it?


You're using CurrentRowNumber property from a TableRecords, right?

Please post details of how you're coming to this result...

Solution

Hi Guys,

I using a local variable and a list in my mobile app. 


Barcode.Current + " " + Barcode.CurrentRowNumber + 1

is how I did it. 

And the solution is:


Barcode.Current + " " + (Barcode.CurrentRowNumber + 1)

7 grade mathmatics I guess... Thanks for your help guys!


Talking about mathmatics and logic. I am pretty sure that having the first row as row 0 is wrong and I don´t understand this logic of Outsystems...


Tobias 

Solution

BigSlikTobi wrote:

Hi Guys,

I using a local variable and a list in my mobile app. 


Barcode.Current + " " + Barcode.CurrentRowNumber + 1

is how I did it. 

And the solution is:


Barcode.Current + " " + (Barcode.CurrentRowNumber + 1)

7 grade mathmatics I guess... Thanks for your help guys!

Hi Tobias,

Let me explain to you what is happening.

When an expression is being evaluated, if the platform founds a string at some level that is being concatenated to anything else (+), everything being concatenated will be converted to a string implicitly (or an error will be raised if this is not possible, I'm almost sure). But the expression takes into account the precedence of operators, so, when you applied the parenthesis in the second case, first the sub-expression is evaluated and only then it is implicitly converted to a string and concatenated to the text.

Talking about mathmatics and logic. I am pretty sure that having the first row as row 0 is wrong and I don´t understand this logic of Outsystems.

Well, 

OutSystems creates its code for Dot Net and Java platform (only up to version 10), and as both languages use the first index in a list as ZERO (0), you probably should complain with Microsoft and Oracle about that... 

But there is a good reason to be zero the first index. In the past, programs had to work with vectors in the memory, and it was easier to find the memory position using (start memory position + index) than (start memory position + index - 1)...

Almost all languages invented in the world follow this pattern, so I am a bit surprised you find this wrong...

Which other programming language did you use that the first index in a list/array was not zero?

Cheers.

Old school basic and VBA are 1 based I think. But most languages I have programmed in over 40 years are zero based.

Daniël Kuhlmann wrote:

Old school basic and VBA are 1 based I think. But most languages I have programmed in over 40 years are zero based.

VBA I am pretty sure you can define the start index to zero if you want... Basic I don't remember, almost 30 years since I jumped from Basic to C... ??

Cheers

Eduardo,

Ha this discussion has no longer to do with OutSystems, but you are right, you can use the 'Option Base' statement both in VBBasic6 and VBA, it defaults to zero.

Option Base 0

or 

Option Base 1