0

For each record

Hey, 

Really new to this - so bear with me. ๐Ÿ˜…

I have table full of OrderNo. (Salesheader) 
Once a month - I need to fetch the related invoicing costs from a HTTP request.

Having trouble setting up the code as I keep getting all sub-table ordernumbers in the same request. Currently I have a UpdateTable and SalesHeader as a Subtable (Which is absolutly not needed and might not even be the way to go). 

Fixing the date for each request isn't a hassle at the moment - the issue lies within just fetching one specific record.OrderNo 

E.g.
Orders: 12345 & 6789

let currRec := Id;
for Id in 'SalesHeader' do
    do as server
        let url := "https://fakeadress.com/" + 'OrderNo';
        let APIKey := "XXX";
        let response := http("GET", url, {Authorization: APIKey,'content-type': "application/json"}, null);
let abc = response
this.('cost' := abc)
    end
end

This code executes twice with "https://fakeadress.com/123456789"
What I need:
1st request: "https://fakeadress.com/12345"
2nd request: "https://fakeadress.com/6789"

Is this possible or should I look for a workaround?

Thanks! 

2 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 11 mths ago
    • Reported - view

    Would try this:

    for i in select SalesHeader do
        do as server
            let url := "https://fakeadress.com/" + i.'OrderNo';
            let APIKey := "XXX";
            let response := http("GET", url, {Authorization: APIKey,'content-type': "application/json"}, null);
            let abc = response
            i.'cost' := abc
        end
    end
    • Magnus_Dahlros
    • 11 mths ago
    • Reported - view

    Works just magically - thanks alot ๐Ÿ™‚

Content aside

  • Status Answered
  • 11 mths agoLast active
  • 2Replies
  • 72Views
  • 2 Following