Batch run of methods

To do batch update or creation of data I try to run the following code:
for (var i = 0; i < this.SelectedParams.length; i++){
this.NewFamParam = {
"parent_id":null,
"family_revision_id":this.parameters.FamRevId,
"spf_content_id":this.SelectedParams[i].spf_cont_id,
"description":this.SelectedParams[i].description_en,
"formula_id":null,
"is_instance":true,
"order":i+1,
"phase_id":null
}
this.lhpg.createFamilyParameter(this.NewFamParam).subscribe(
(result: any) => {this.notificationService.notify({ severity: "success", summary: Success, detail: Parameter was added });},
(result: any) => {this.notificationService.notify({ severity: "error", summary: Error, detail: Unable to create new FamilyParameter! });});
}

But the compiler complains about the subscribe() method. If I put this code later in .ts file - everything runs as expected. Is it a bug?

I don't understand what the problem is.

But the compiler complains about the subscribe() method

What is the error message?

If I put this code later in .ts file - everything runs as expected

What do you mean?

What I need is a notification message at each step, so I see which of steps are successful. If I edit the resulting .ts file the application runs and built exactly with this functionality. But Radzed doesn't allow me to insert it in the original code.

The code you are using isn't valid TypeScript. Try this one:

for (var i = 0; i < this.SelectedParams.length; i++){
    this.NewFamParam = {
        "parent_id": null,
        "family_revision_id": this.parameters.FamRevId,
        "spf_content_id": this.SelectedParams[i].spf_cont_id,
        "description": this.SelectedParams[i].description_en,
        "formula_id": null,
        "is_instance": true,
        "order": i + 1,
        "phase_id": null
    };

    this.lhpg.createFamilyParameter(this.NewFamParam).subscribe(
        (result: any) => {
            this.notificationService.notify({ severity: "success", summary: `Success`, detail: `Parameter was added` });
        },
        (result: any) => {
            this.notificationService.notify({ severity: "error", summary: `Error`, detail: `Unable to create new FamilyParameter!` });
        }
    );
}

The same. "Unexpected identifier"

You can load the project in Visual Studio (Professional or Code) and see what exactly the TypeScript error is.

VS does not show any error and the application compiles and works as expected. This is what I meant in my first message.

I didn't understand this is what you meant. Where is this code entered in Radzen? What kind of action is that - Set property, Execute Code? You can paste a screenshot from the event editor so we can check it further.

I use it in a button event to run batch process:

Got it. It seems to be using `` that breaks our internal parser. You can use " as a workaround:

OLD:

    this.lhpg.createFamilyParameter(this.NewFamParam).subscribe(
        (result: any) => {
            this.notificationService.notify({
             severity: "success", 
             summary: `Success`, 
             detail: `Parameter was added` 
          });
        },
        (result: any) => {
            this.notificationService.notify({ 
               severity: "error", 
               summary: `Error`, 
               detail: `Unable to create new FamilyParameter!` 
           });
        }
    );

NEW:

 this.lhpg.createFamilyParameter(this.NewFamParam).subscribe(
        (result: any) => {
            this.notificationService.notify({
             severity: "success", 
             summary: "Success", 
             detail: "Parameter was added"
          });
        },
        (result: any) => {
            this.notificationService.notify({ 
               severity: "error", 
               summary: "Error", 
               detail: "Unable to create new FamilyParameter!" 
           });
        }
    );

Yep, now it works, thank you.

We will fix that with the next release.

Radzen 2.10.1 just released with fix for this included!