I saw ～たのでした in a Japanese storybook. I didn't have any idea about it because I only know ～たのです（～たんです） if I want to say something in the past. I am wondering if ～たのでした（～たんでした） is the concept of past perfect. To make my idea more clear, there is a similar paragraph I made.
喉が乾いたヤギが井戸に通りかかって、キツネがヤギを見て 井戸の底でいていたくせに この井戸の水が美味しいよと言いました。キツネはいつも利口に生きていましたが、まだ井戸に落ちたのでした。 from http://hukumusume.com/douwa/pc/aesop/08/25.htm
I made my own version of the story to highlight what I wanted to ask. Sorry for my bad Japanese. What is ～たのでした ? Isn't ～たのです enough to express the idea that something is in the past?
It made me think of one question about Japanese. When it comes to English, we use past perfect to express the idea that something occurred before another action in the past.
Take the paragraph below for example:
I ran into one of my old friends yesterday. He invited me to get something to eat, and he recommended the new burger king. Actually, I had just had my lunch there. I had just eaten a lot over there. At last, I said "thanks man, maybe next time."
When it comes to Japanese, what should I say to express the same idea?