Is there a way to make the auto increment field prefixed by 000? - auto-increment

Is there a way to make the auto increment field prefixed by 000? For example instead of making it run from the number '1' it should auto increment in this method '001' then 002 and so on?

Leading zeroes are meaningless in a decimal integer.
You could display that however using printf("%03d", id) or equivalent.

Not really, otherwise it wouldn't be a real integral type, it would be a string.
If you need that, you might want to use your language's formatting function(s) to display it with padding zeroes.

Related

Delphi strToint64 initial with zero value

in Delphi XE8 I have to convert a '03213213210' string into an int64
a:=strToint64('03213213210');
I receive a = 3213213210; How can i receive? a = 03213213210;
Help me. Thank you.
An Int64 is a numeric value. It holds a number. Numbers have no concept of formatting, leading zeros, representation base etc. A number is just a number.
Concepts such as binary, octal, decimal, hexadecimal have no impact on the value of the number, just its representation. Similarly, formatting requirements such as a set number of digits are not related to the value, but are a property of formatting of the value for display.
In short, leading zeros are not a property of a number. Your Int64 variable contains the number. When you choose to display it, you may opt to enforce a set number of digits, for instance by padding with leading zeros to achieve that number. But that's not a property of the number, the Int64 variable. That's a property of how you choose to display it.
So, if you really need to send the value as an Int64, then you have nothing more to do. If it needs to be displayed with 11 digits, with zero left padding, then that formatting is the responsibility of whoever displays it. On the other hand, it is possible that you should be holding the value as a string in order to preserve the formatting.
I can't tell which of the two options above is what you need to do, but I can be quite sure that trying to store leading zeros in an Int64 is not the solution because that is not possible.

How can I change positive value to zero in Excel

I have two columns for the time in and time out of the employee, and I want to determine their lates and undertimes. But I cannot properly do it, I already can do the negative value to zero but I just want to know how to do the positive value to zero.
This is my formula =(G10-C10)*1440 then as per my column values it will show a positive value but I want the positive value become ZERO
Thanks!
You could use IF, which would be the most popular choice:
=IF(G10-C10>0,0,(G10-C10)*1440)
Could be read as, 'if the difference is greater than 0 (positive), then put 0, otherwise put the difference itself'.
Or a little less common, but simpler:
=MIN((G10-C10)*1440,0)
As an alternative to Jerry's answer, after applying your original formula, you can change the format of the cells to something like this:
"0";-0;0
The first 0 is for positive. The quotes around it make sure the zero gets displayed literally.
The second section (each section separated by a semi-colon ;) is for negative and the last one's for zero values.
The zero without quotes here means that one number should get displayed compulsorily.
Here's the output:

Trying to show only a certain amount of numbers

To make the sale to my customer I need to import numbers from a report into an Excel document. For example the number coming in will be 14.182392. The only reason for my guy not to buy the product is because he only wants to view 14.182 on the Excel sheet. Okay so the other catch is, the number CANNOT be rounded in any shape or form.
So what I need is a way to just show so much of number, WITHOUT ROUNDING.
Is this possible? Any ideas of how I could get around this would be fantastic.
Please try:
=TEXT(INT(A1)+VALUE(LEFT(MOD(A1,1),5)),"00.000")
Firstly =TRUNC is a better answer (much shorter). My version was connected with uncertainty in your requirement (it is odd!) and in the hope it might be easier to adjust if not exactly what you/your boss wanted.
TRUNC literally just truncates the decimals (no rounding!) to a length to suit (ie 3 if to show nn.182 given nn.182392 or say nn.182999).
LEFT may also be a better choice, but that depends upon knowing how large the integer part of your number is. =LEFT(A1,6) would display 14.189 given say 14.189999 in A1. However it would show 1.4189 given 1.4189999 in A1 (ie four decimal places).
The formula above combines text manipulation with number manipulation.:
INT takes just the integer value (here 14.)
MOD takes just the modulus – the residual that is not an integer after division, in this case by 1. So just the .182392 part. LEFT is then applied here in a similar way to as used above, but without needing to concern oneself with the length of the integer part of the source value (ie 14 or 1 etc does not matter).
VALUE then converts the result back into numeric format (string manipulation functions such as LEFT always return text format) so our abbreviated decimal string can then be added to our integer.
Finally, the TEXT part is for formatting but is hard or impossible to justify! About the only use is that it displays the result left-justified in the cell – perhaps a little warning that the number displayed is not the “true” value (eg it won’t SUM) because, as a result of a formula, it won’t be marked with a little green warning triangle.
The displayed values can use the TRUNC function like this,
=TRUNC(A1, 3)
But you must use A1 in any calculations to retain the precision of the raw value.
Easiest way I know:
=LEFT(A1; x)
where x = the amount of characters You want. Mind that the dot counts as a character as well.

I want to type cast in openlaszlo?

I want to type cast in openlaszlo if any one work on it then tell me. One big task is pending for that smaller issue. It immediate. when i compare 2 digit number it get only first digit.
Number(variable) it working if you want to compare two number more than one digit then you must use Number for type casting otherwise compiler treat that number as a one digit number and u might be get wrong output.

Currency summation in Lotus Notes

We have designed the LN forms with editable fields.User enters the amounts in the editable fields. We are converting the these amounts to currency using 'CCur'. The actual issue is user enters the amounts with decimal separator either as comma(,) or dot(.). When converting the amounts to currency it is not considering the decimal and thousands separator.
Example:
User enters amounts as below: Amount1 = 2090,Amount2 = 1500,90 and Amount3 = 800
In the current case the TOTAL AMOUNT is calculated as 152980.00 which should be 4390.90
How can I achieve this? Do we have user specific settings in LN which automatically takes care such things?
Regards,
Kishore
It sounds like your currency formats may not be set up correctly, and thus the locale of the client being used to enter the value 1500,90 is one that assumes the comma is a thousands separator, and the period is a decimal separator.
Here is one section of the documentation to check-out. You may need to confirm the field settings on the form to see if a custom currency format has been specified. Otherwise, see what the user preferences of the client says
For this question, I am not clear that why are you using comma as a decimal separator, I guess that it is not a formal way for storing the currency value. I can understand. this is your requirement. Just Take this as a suggestion. Okay We have the field property, First you change the field type as Number. And set the field control property, Number format is as currency and Change the User preference as Custom. There you can find two kind of settings enabled. Here you change the thousand separator into a different symbol. But I guess that you can not give multiple separator for decimal or thousands. Also If you give the same symbol for both things. It will be conflict.
My opinion- Based on your requirement, You do replace the comma with dot before applying the Ccur().
#Ramkumar: I don't agree. Set the field settings to Numeric and "User settings", not "custom". The users need to use the correct decimal point, if they are in a country where a period is used for decimal point, they use that, if they are in a country where they use comma as decimal point, they use that.
Kishore, you could add a field validation on the numeric field to make sure the value is numeric.
Use #IsNumber for this.

Resources