Expand my Community achievements bar.

SOLVED

Dynamic Table

Avatar

Former Community Member

I want to add a row in a table based upon Number given in a textfield, eg- if 5 is given 5 rows must be added,again if some other no. is given then that many rows only should be present + if no. is greater than the previous then those rows should be retained so that user dont have to write again , please suggest something. i have kept the row in a subform and i am able to get the result for 1st time but when changing the value desired reult is not obtained

for (var i = val; i>1 ;i--)

   {

     _test.removeInstance(i-1);

   }

this is the simple code used,i am not able to use it with right condition i guess.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi Kunal,

Pls try doing the following:

1) Reomove all the script on the exit event of "NumArticle"

2) Don't set max count.

3) Set only min count = 1

4) Add the following script on the exit event of "NumArticle"

Form1_Dtls.MainPage.EntrenchmentDetails.instanceManager.count = this.rawValue;

[Don't add any other script other than the above line]

Pls give a try and let me know.

Thanks,

VJ

View solution in original post

14 Replies

Avatar

Former Community Member

Hi Kunal,

You can use the following script on the exit event of the numeric field:

 

form.Page1.Table1.Row1.instanceManager.count = this.rawValue;

Where, Row1 is your repeating row.

Let me know if this works.

Thanks,

VJ

Avatar

Former Community Member

thanks,its working,but i am getting 1 row extra,subform+instances,but i only want instances,then what to do ?

Avatar

Former Community Member

Is it not possible to send a sample form - A form in which only the repeating subform copied and confidential data masked?

btw, did u select min count = 1 ?

Thanks,

VJ

Avatar

Former Community Member

yes i kept the min and max count,the only prob is one extra row is coming,

----- Form1_Dtls.MainPage.NumArticles.NumArticle::exit - (JavaScript, client) ----------------------

if(this.rawValue != null)
{
  var val = this.rawValue;

if ( val > 91)  val = 91;
  for(var i=1; i<val ; i++)
  {
  
  Form1_Dtls.MainPage.EntrenchmentDetails.instanceManager.count = this.rawValue;

   _EntrenchmentDetails.addInstance(0);
   
}
}

this is the code i used,even i tried with i in addInstance,but dint work

Avatar

Correct answer by
Former Community Member

Hi Kunal,

Pls try doing the following:

1) Reomove all the script on the exit event of "NumArticle"

2) Don't set max count.

3) Set only min count = 1

4) Add the following script on the exit event of "NumArticle"

Form1_Dtls.MainPage.EntrenchmentDetails.instanceManager.count = this.rawValue;

[Don't add any other script other than the above line]

Pls give a try and let me know.

Thanks,

VJ

Avatar

Former Community Member

thanks alot vijay it is working,u saved a lot of my time.

Avatar

Former Community Member

Hi Kunal,

No problem.

can u mark this answer as "Correct"? This would be helpful to others.

Thanks,

VJ

Avatar

Former Community Member

Hi VJ,

I am using this form with radio buttons,on yes this functionality works,but on NO,how to hide the instances ?

Avatar

Former Community Member

You can hide the entire section as:

Form1_Dtls.MainPage.EntrenchmentDetails.presence = "hidden";

Thanks,

VJ

Avatar

Former Community Member

with this only main subform is hiding,instances are not going,i already applied this

Avatar

Former Community Member

If your repeating instances are a part of your main subform, then the instances should also hide.

Make sure that your instances are inside you main subform and not outside or at same level of the main subform.

--- The following is correct -----

<subform>

     <repeatingsubform>

</subform>

--- The following is wrong -----

<subform></subform>

</repeatingsubform> </repeatingsubform>

I could check if you can share me the sample template.

Thanks,

VJ

Avatar

Former Community Member

<subform>

     <repeatingsubform>

</subform>

i am following this hierarchy throughout the form

but for this i am giving radiobutton condition in one subform,textfield condition in another,and then repeating is 3rd,shall i keep these 3 subforms again in a single subform ?

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] ----