Help on Formula

Hi,

I’m getting a new project, where someone else was developing before. I have no contact with him, so I don’t understand what he was trying to do. I will give the picture:

There is a database containing all projects from the company. There is an extra view being used by another database. The view contains a few columns, and one of them is giving an error. This column should display the project number, which is a field in the document.

I can’t understand why, the previous developer, uses a formula to show as:

@Right(“0000000”+@Left(CAutoNumber;“-”);7)+“-”+@Right(“000”+@RightBack(CAutoNumber;“-”);3)

where CAutoNumber is the field with the project number. This field is unique.

I know script, but formula is quite confusing for me. Can someone help and explain what he was trying to achieve with that?

Can I just change it to LS?

Thank’s

Daniel

Subject: Help on Formula

If you have a field value of CAutoNumber is 123456789-987654321. Then @Right(“0000000”+@Left(CAutoNumber;“-”);7) will return 3456789. and @Right(“000”+@RightBack(CAutoNumber;“-”);3) will return 321. so the actual formula @Right(“0000000”+@Left(CAutoNumber;“-”);7)+“-”+@Right(“000”+@RightBack(CAutoNumber;“-”);3) will return 3456789-321. Hope this helps in figuring it out what the previous developer trying to do. It is just trimming the coming out to a value which is unique i guess.

Cheers

sri.

Subject: RE: Help on Formula

Thank’s all.

Really helped. I was checking here, and they don’t even need the leading zeros… It was here because when they imported from older system, it was there…

Thank’ a lot.

Daniel

Subject: Help on Formula

I think the nr consists of two elements separates by an -.

The nr can be variable length.

This formula fills out the nr with zero’s.

So

23-7 will be 0000023-007

127-17 will be 0000125-017

Subject: RE: Help on Formula

Thank’s.

The number does not contain an hifen, it’s only a sequential number. Currently 12983. next project will be 12984. I will try to only add the zeros before.

Can this be done by LS? I just don’t know formula language… (my fault :wink:

Daniel

Subject: RE: Help on Formula

this can be done in LS:

right(“0000000” & cStr(doc.numberfield(0)), 7)

in formula language:

@right(“0000000” + numberfield, 7)