cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate the sequential number in Javascript

Former Member
0 Kudos

Hi ,

I am facing one issue.

I am adding the record to the underneath record and it works fine. But I have one problem there. I am having 10 records and adding one record between any of those records. I can able to reinitialize the index using xfa.form.recalculate(1). it works fine..

Issue is : Newly inserted subform has 10 fields....But the issue is, I have to populate the number on the one of the field(F1) in newly added recordbetween 8&9 and the field F1 values to be 001. If I add second record between 18th and 19th record that record F1 field should become 002...It is not one way they may even create the record between 2 and 3 after created the 18th record.. Now I have to renumbering the all newly added records like 2&3 F1 become 001....8&9 F1 become 002...18th&19th F1 should have 003..

As you said, I took the get full year with substring. The number is : last two digit of year+ F or R + (sequence number 001 or 002 or 003 only newly added record fields F1)..

I added the code in click event rightnow I am getting 10F- ... I dont know how to get sequence number for Only Newly added records..

when I add it first time I can populate the 001..But when I add the second record I have to somehow remind it already I added 001 and this time I have to add 002..Globally can we declare the varaible ?

Help really appreciated...

Thanks

GJ

Accepted Solutions (1)

Accepted Solutions (1)

former_member226239
Contributor
0 Kudos

You can create global variables.

To create global variables go to: Edit > Form Properties > Variables

Thanks,

Chandra Indukuri

Former Member
0 Kudos

Hi Chandra,

let say I am creating one global varaible a = 1. In the event directly I can use a = a++ like that right..No need of var a statement..

Thanks

GJ

former_member226239
Contributor
0 Kudos

Yes.

In order to get the value of the global variable use .value

eg: a.value = a.value + 1;

Answers (0)