Web Hook Json count rows

Hello, looking for some help. I have a Web hook that is currently working but I’m trying to number is each row that is created in the table with this Json Web hook.
With my test data there are three new rows create, I would like the “PurchaseOrderDetailLineNum”:"???" column to be populated as:

1
2
3

I have try to a do select but each row is populated with a 3 rather sequentially

Here is the Json:
{
“Action”: “Add”,
“Properties”: {
“Locale”: “en-US”,
“Location”: “47.623098, -122.330184”,
“Timezone”: “Pacific Standard Time”,
“RunAsUserEmail”: "YourEmail@google.com"
},
“Rows”: [

<<start:select([Releated Inventory Reorder][InventoryKey],[InventoryOrderYes] = true)>>
{

     "PurchaseOrderDetailPoNum":"<<[PurchaseOrderKey]>>",
	 "PurchaseOrderDetailLineNum":"??????"
	 "PurchaseOrderDetailItem": "<<[InventoryItemKey]>>",
     "PurchaseOrderDetailQuantity": "<<[InventoryOrder]>>"

  
  },
  <<End>>

]
}

0 3 567
3 REPLIES 3

I do not know how to generate sequential numbers for the row keys.

Instead, I would recommend using a Text field as the key and specifying an InitialValue of UNIQUEID().
That way you will not need to specify the key value when calling the API.
The API will automatically populate the key values for you.

For more details, see the first paragraph under topic “Body” in this article https://help.appsheet.com/integrations/api/adding-records-to-a-table

Thanks for the feed back, but I’m looking to number each row not create an unique row key.

Hi Adam,

If I understand you question correctly, it is an instance of what is described in this article https://help.appsheet.com/data/keys/sequential-keys

Although the linked article is primarily about keys, it applies equally to sequentially increasing values in a column that is not a key. This is explained in the last sentence of the third paragraph.

The alternative is to use a random system generated value such as UNIQUEID() or RandBetween().

Users frequently ask how to generate sequential values. It seems like it should be easy. Unfortunately, it is actually very hard or impossible in a distribute multi-user system with offline update. My goal in responding to you question is to share that information with you. I hope it is helpful.

Sometimes there are tricks that will work in particular cases. Someone in the community my be able to suggest something that will work in your case. I hope so.

Top Labels in this Space