Expand my Community achievements bar.

SOLVED

How to count first column automatically.

Avatar

Level 3

Dear All.

I'd like to calculate first column from 1 to N, when the Add Row button is clicked.

Please refer to followings

-------------------------------------- Code --------------------------------------

var nNodes = Test_Result1.sub_Product_accessories.Config_Acc.resolveNodes("Config_Acc[*]").length;


if (nNodes <= 6){
  Test_Result1.sub_Product_accessories.Config_Acc.instanceManager.addInstance();
}

AS-IS

count.JPG

TO-BE

count2.JPG

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

On the Initialize event of the AccNum field out the javascript code:

this.rawValue= this.parent.index + 1

View solution in original post

4 Replies

Avatar

Former Community Member

There is a property of the instance Manager called count that will give you the number of rows that you have....

subformName.instanceManager.count

You can also ask for the index of a subform and it will indicate which instance number the object is within. So in your case you can add code to the Initialize event of the DD Object in the first column and ask for its parent.index .....so

this.parent.index

Note that the indexes are 0 based so you will have to add 1 to it after you get the value.

Hope that helps

Paul

Avatar

Level 3

Dear Paul.

Thank you for your valuable comment.

Would i ask you one more question?

I've got the number of raw, but don't know how to add its number to add specific field which is added(Acc_Num).

also, if you don't mind, could you suggest a book of LiveCycle Designer to learn by myself.

------------------------------------------------------------- Code -----------------------------------------------------------------------

  Test_Result1.sub_Product_accessories.Config_Acc.instanceManager.addInstance();
  app.alert(Test_Result1.sub_Product_accessories.Config_Acc.instanceManager.count);


fsfsfs.JPG

Avatar

Correct answer by
Former Community Member

On the Initialize event of the AccNum field out the javascript code:

this.rawValue= this.parent.index + 1

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----