Xavier LARTEM
Xavier LARTEM

Reputation: 139

Acumatica Delete from Graph

I would like to delete a record from a graph, I can easily add one, but what is the syntax for deleting one with filter on Immatriculation field :

Example do add

ZVEHICULEGRAPH graph = PXGraph.CreateInstance<ZVEHICULEGRAPH>();
ZVEHICULE dac = new ZVEHICULE();
dac.Fichiernom="FICHIER.CSV";
dac.Fichierligne=55;
dac.Immatriculation= "AA-HH-38";

graph.ListViewZVEHICULE.Insert(dac);
graph.Actions.PressSave();

With this graph

namespace FLEXFORYOU
{
  public class ZVEHICULEGRAPH : PXGraph<ZVEHICULEGRAPH>
  {
    public SelectFrom<ZVEHICULE>.View ListViewZVEHICULE;
    public PXSave<ZVEHICULE> Save;
    public PXCancel<ZVEHICULE> Cancel;
  }
}

Thanks Xavier

Upvotes: 2

Views: 317

Answers (1)

diegoapereza
diegoapereza

Reputation: 186

There are 2 main ways to do this.

Call delete passing the record as parameter on the View.

 ZVEHICULEGRAPH graph = PXGraph.CreateInstance<ZVEHICULEGRAPH>();
    ZVEHICULE dac = graph.ListViewZCLIENT.Current = graph.ListViewZCLIENT.Search<ZVEHICULE.immatriculation>("AA-HH-38");
                graph.ListViewZCLIENT.Delete(dac);
                graph.Save.Press();

Call delete passing key dictionary. You would need to call the delete method using a dicctionary. e.g:

cache.Delete(keys, values); // Where keys are the [IsKey] properties of your dac and values their values.

Upvotes: 1

Related Questions